Add Anti-Features in READMEs

This commit is contained in:
Tagadda
2022-02-23 07:18:05 +00:00
parent 6b97ef7a19
commit 499db257a1
4 changed files with 29 additions and 0 deletions

View File

@ -3,6 +3,7 @@
import argparse
import json
import os
import yaml
from pathlib import Path
from jinja2 import Environment, FileSystemLoader
@ -18,6 +19,11 @@ def generate_READMEs(app_path: str):
manifest = json.load(open(app_path / "manifest.json"))
upstream = manifest.get("upstream", {})
catalog = json.load(open(Path(os.path.abspath(__file__)).parent.parent.parent / "apps.json"))
from_catalog = catalog.get(manifest['id'], {})
antifeatures_list = yaml.load(open(Path(os.path.abspath(__file__)).parent.parent.parent / "antifeatures.yaml"))
if not upstream and not (app_path / "doc" / "DISCLAIMER.md").exists():
print(
"There's no 'upstream' key in the manifest, and doc/DISCLAIMER.md doesn't exists - therefore assuming that we shall not auto-update the README.md for this app yet."
@ -53,6 +59,12 @@ def generate_READMEs(app_path: str):
else:
disclaimer = None
# TODO: Add url to the documentation... and actually create that documentation :D
antifeatures = [antifeatures_list[a] for a in from_catalog.get('antifeatures', [])]
for antifeature in antifeatures:
antifeature['title'] = antifeature['title'].get(lang_suffix, 'en')
antifeature['description'] = antifeature['description'].get(lang_suffix, 'en')
out = template.render(
lang=lang,
upstream=upstream,