1
0
Fork 0

smol fixes

This commit is contained in:
OniriCorpe 2024-03-07 00:33:28 +01:00 committed by OniriCorpe
parent 2186eb6fcd
commit 221429766e
2 changed files with 18 additions and 13 deletions

View file

@ -1,23 +1,23 @@
# Auto-README generation
### Initial install
## Initial install
```
```bash
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```
### Use on a single app
## Use on a single app
```
```bash
source venv/bin/activate
./make_readme.py /path/to/app
```
Then the README.md in the app folder will be updated
### Launch webhook service for auto update
## Launch webhook service for auto update
Configure the webhook on github

View file

@ -10,14 +10,14 @@ from jinja2 import Environment, FileSystemLoader
def value_for_lang(values, lang):
if not isinstance(values, dict):
return values
if lang in values:
return values[lang]
elif "en" in values:
return values["en"]
else:
return list(values.values())[0]
if not isinstance(values, dict):
return values
if lang in values:
return values[lang]
elif "en" in values:
return values["en"]
else:
return list(values.values())[0]
def generate_READMEs(app_path: str):
@ -35,8 +35,11 @@ def generate_READMEs(app_path: str):
catalog = toml.load(open(Path(os.path.abspath(__file__)).parent.parent.parent / "apps.toml"))
from_catalog = catalog.get(manifest['id'], {})
print(catalog)
print(from_catalog)
antifeatures_list = toml.load(open(Path(os.path.abspath(__file__)).parent.parent.parent / "antifeatures.toml"))
print(antifeatures_list)
if not upstream and not (app_path / "doc" / "DISCLAIMER.md").exists():
print(
@ -82,6 +85,8 @@ def generate_READMEs(app_path: str):
else:
antifeatures[k]['description'] = value_for_lang(antifeatures[k]['description'], lang)
print(lang + "\n")
out = template.render(
lang=lang,
upstream=upstream,