Merge branch 'master' into enh-readme-current-branch
This commit is contained in:
commit
ccc42d0d5b
5 changed files with 46 additions and 0 deletions
|
@ -3,10 +3,20 @@
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import yaml
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from jinja2 import Environment, FileSystemLoader
|
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]
|
||||||
|
|
||||||
def generate_READMEs(app_path: str):
|
def generate_READMEs(app_path: str):
|
||||||
|
|
||||||
|
@ -21,6 +31,9 @@ def generate_READMEs(app_path: str):
|
||||||
catalog = json.load(open(Path(os.path.abspath(__file__)).parent.parent.parent / "apps.json"))
|
catalog = json.load(open(Path(os.path.abspath(__file__)).parent.parent.parent / "apps.json"))
|
||||||
from_catalog = catalog.get(manifest['id'], {})
|
from_catalog = catalog.get(manifest['id'], {})
|
||||||
|
|
||||||
|
antifeatures_list = yaml.load(open(Path(os.path.abspath(__file__)).parent.parent.parent / "antifeatures.yml"), Loader=yaml.SafeLoader)
|
||||||
|
antifeatures_list = {e['id']: e for e in antifeatures_list}
|
||||||
|
|
||||||
if not upstream and not (app_path / "doc" / "DISCLAIMER.md").exists():
|
if not upstream and not (app_path / "doc" / "DISCLAIMER.md").exists():
|
||||||
print(
|
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."
|
"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."
|
||||||
|
@ -66,12 +79,22 @@ def generate_READMEs(app_path: str):
|
||||||
else:
|
else:
|
||||||
default_branch_version = None # we don't care in that case
|
default_branch_version = None # we don't care in that case
|
||||||
|
|
||||||
|
# TODO: Add url to the documentation... and actually create that documentation :D
|
||||||
|
antifeatures = {a: antifeatures_list[a] for a in from_catalog.get('antifeatures', [])}
|
||||||
|
for k, v in antifeatures.items():
|
||||||
|
antifeatures[k]['title'] = value_for_lang(v['title'], lang_suffix)
|
||||||
|
if manifest.get("antifeatures", {}).get(k, None):
|
||||||
|
antifeatures[k]['description'] = value_for_lang(manifest.get("antifeatures", {}).get(k, None), lang_suffix)
|
||||||
|
else:
|
||||||
|
antifeatures[k]['description'] = value_for_lang(antifeatures[k]['description'], lang_suffix)
|
||||||
|
|
||||||
out = template.render(
|
out = template.render(
|
||||||
lang=lang,
|
lang=lang,
|
||||||
upstream=upstream,
|
upstream=upstream,
|
||||||
description=description,
|
description=description,
|
||||||
screenshots=screenshots,
|
screenshots=screenshots,
|
||||||
disclaimer=disclaimer,
|
disclaimer=disclaimer,
|
||||||
|
antifeatures=antifeatures,
|
||||||
manifest=manifest,
|
manifest=manifest,
|
||||||
current_branch=current_branch,
|
current_branch=current_branch,
|
||||||
default_branch=default_branch,
|
default_branch=default_branch,
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
jinja2
|
jinja2
|
||||||
sanic
|
sanic
|
||||||
|
pyyaml
|
||||||
|
|
|
@ -51,6 +51,15 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
||||||
{{ disclaimer }}
|
{{ disclaimer }}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|
||||||
|
{% if antifeatures -%}
|
||||||
|
## :red_circle: Antifeatures
|
||||||
|
|
||||||
|
{% for antifeature in antifeatures.values() -%}
|
||||||
|
- **{{ antifeature.title }}**: {{ antifeature.description }}
|
||||||
|
|
||||||
|
{% endfor -%}
|
||||||
|
{% endif -%}
|
||||||
|
|
||||||
## Documentation and resources
|
## Documentation and resources
|
||||||
|
|
||||||
{% if upstream.website -%}* Official app website: <{{ upstream.website }}>
|
{% if upstream.website -%}* Official app website: <{{ upstream.website }}>
|
||||||
|
|
|
@ -37,6 +37,16 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
|
||||||
{{ disclaimer }}
|
{{ disclaimer }}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|
||||||
|
{% if antifeatures -%}
|
||||||
|
## :red_circle: Fonctions indésirables
|
||||||
|
|
||||||
|
{% for antifeature in antifeatures.values() -%}
|
||||||
|
- **{{ antifeature.title }}**: {{ antifeature.description }}
|
||||||
|
|
||||||
|
{% endfor -%}
|
||||||
|
{% endif -%}
|
||||||
|
|
||||||
|
|
||||||
## Documentations et ressources
|
## Documentations et ressources
|
||||||
|
|
||||||
{% if upstream.website -%}* Site officiel de l'app : <{{ upstream.website }}>
|
{% if upstream.website -%}* Site officiel de l'app : <{{ upstream.website }}>
|
||||||
|
|
|
@ -26,6 +26,8 @@ def _convert_v1_manifest_to_v2(app_path):
|
||||||
if "url" in manifest and "website" not in manifest["upstream"]:
|
if "url" in manifest and "website" not in manifest["upstream"]:
|
||||||
manifest["upstream"]["website"] = manifest["url"]
|
manifest["upstream"]["website"] = manifest["url"]
|
||||||
|
|
||||||
|
manifest["upstream"]["cpe"] = "???"
|
||||||
|
|
||||||
manifest["integration"] = {
|
manifest["integration"] = {
|
||||||
"yunohost": manifest.get("requirements", {}).get("yunohost"),
|
"yunohost": manifest.get("requirements", {}).get("yunohost"),
|
||||||
"architectures": "all",
|
"architectures": "all",
|
||||||
|
@ -158,6 +160,7 @@ def _dump_v2_manifest_as_toml(manifest):
|
||||||
upstream = table()
|
upstream = table()
|
||||||
for key, value in manifest["upstream"].items():
|
for key, value in manifest["upstream"].items():
|
||||||
upstream[key] = value
|
upstream[key] = value
|
||||||
|
upstream["cpe"].comment("FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)")
|
||||||
toml_manifest["upstream"] = upstream
|
toml_manifest["upstream"] = upstream
|
||||||
|
|
||||||
integration = table()
|
integration = table()
|
||||||
|
|
Loading…
Reference in a new issue