From a1b9ade4f13f6851b17e30585436e3a3b3171541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 13 Aug 2024 09:36:36 +0200 Subject: [PATCH] readme_generator: use get_apps_repo --- readme_generator/make_readme.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/readme_generator/make_readme.py b/readme_generator/make_readme.py index 4e159bf..764d744 100755 --- a/readme_generator/make_readme.py +++ b/readme_generator/make_readme.py @@ -36,7 +36,7 @@ def value_for_lang(values: Dict, lang: str): return list(values.values())[0] -def generate_READMEs(app_path: Path, catalog_path: Path): +def generate_READMEs(app_path: Path, apps_repo_path: Path): if not app_path.exists(): raise Exception("App path provided doesn't exists ?!") @@ -47,11 +47,11 @@ def generate_READMEs(app_path: Path, catalog_path: Path): upstream = manifest.get("upstream", {}) - catalog = toml.load((catalog_path / "apps.toml").open(encoding="utf-8")) + catalog = toml.load((apps_repo_path / "apps.toml").open(encoding="utf-8")) from_catalog = catalog.get(manifest["id"], {}) antifeatures_list = toml.load( - (catalog_path / "antifeatures.toml").open(encoding="utf-8") + (apps_repo_path / "antifeatures.toml").open(encoding="utf-8") ) if not upstream and not (app_path / "doc" / "DISCLAIMER.md").exists(): @@ -193,16 +193,16 @@ def generate_READMEs(app_path: Path, catalog_path: Path): (app_path / "ALL_README.md").write_text(out) -if __name__ == "__main__": - parser = argparse.ArgumentParser( - description="Automatically (re)generate README for apps" - ) - parser.add_argument( - "app_path", type=Path, help="Path to the app to generate/update READMEs for" - ) +def main(): + parser = argparse.ArgumentParser(description="Automatically (re)generate README for apps") + parser.add_argument("app_path", type=Path, help="Path to the app to generate/update READMEs for") get_apps_repo.add_args(parser) args = parser.parse_args() apps_path = get_apps_repo.from_args(args) - generate_READMEs(Path(args.app_path), apps_path) + generate_READMEs(args.app_path, apps_path) + + +if __name__ == "__main__": + main()