-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code updates for git->codehost change
- Loading branch information
1 parent
7e12d53
commit 2ac476c
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# | ||
|
||
import argparse | ||
import frontmatter | ||
import os | ||
import yaml | ||
|
||
default_path = "../www/logos" | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--directory", help="directory with logo subdirectories", action="store", default=default_path) | ||
parser.add_argument("-q", "--quiet", help="hide status messages", default=True, dest='verbose', action="store_false") | ||
|
||
args = parser.parse_args() | ||
|
||
logoroot = args.directory | ||
dirs = [f for f in os.listdir(logoroot) if os.path.isdir(os.path.join(logoroot, f))] | ||
dirs.sort() | ||
for logodir in dirs: | ||
#print("INFO: procssing %s" % logodir) | ||
|
||
indexfn = os.path.join(logoroot, logodir, "index.md") | ||
if os.path.exists(indexfn) == False: | ||
print("WARNING: no index.md for %s" % logodir) | ||
continue | ||
|
||
indexmd = frontmatter.load(indexfn) | ||
|
||
if "git" not in indexmd.keys(): | ||
print("DEBUG: skipping %s (%s)" % (indexmd["title"], indexmd["logohandle"])) | ||
continue | ||
print("DEBUG: processing %s (%s)" % (indexmd["title"], indexmd["logohandle"])) | ||
|
||
indexmd["codehost"] = "https://github.com/%s" % indexmd["git"] | ||
del indexmd["git"] | ||
|
||
#print("%s" % frontmatter.dumps(indexmd)) | ||
|
||
frontmatter.dump(indexmd, indexfn) |