-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
47 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
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,31 @@ | ||
#!/usr/bin/env python3 | ||
import os | ||
import sys | ||
import tomllib | ||
|
||
def error(msg): | ||
print('ERROR:', msg, file=sys.stderr) | ||
sys.exit(1) | ||
|
||
def check_author(author_path): | ||
print(f"Checking {author_path}...") | ||
|
||
with open(author_path, 'rb') as f: | ||
meta = tomllib.load(f) | ||
|
||
if 'name' not in meta: | ||
error(f'No `name` in `meta` section of {author_path}') | ||
|
||
if 'description' not in meta: | ||
error(f'No `description` in `meta` section of {author_path}') | ||
|
||
# Logo is optional, but if defined a corresponding image must exist | ||
if 'logo' in meta: | ||
logo_filename = f"{meta['logo']}.png" | ||
logo_path = os.path.join("common/images/author-images", logo_filename) | ||
if not os.path.isfile(logo_path): | ||
error(f'Logo image does not exist at {logo_path} for {author_path}') | ||
|
||
if __name__ == '__main__': | ||
for f in sys.argv[1:]: | ||
check_author(f) |
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