From 775c6ef6274b94d0a21b7dc7792ee057b8ed8dfd Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Wed, 13 Mar 2024 02:45:34 +0100 Subject: [PATCH] readme-generator: only pick files (no folder) on the root of 'screenshots' --- readme_generator/make_readme.py | 8 +++++--- readme_generator/templates/README.md.j2 | 2 +- readme_generator/templates/README_fr.md.j2 | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/readme_generator/make_readme.py b/readme_generator/make_readme.py index e7164ad..cbaeed0 100755 --- a/readme_generator/make_readme.py +++ b/readme_generator/make_readme.py @@ -83,11 +83,13 @@ def generate_READMEs(app_path: Path): screenshots: List[str] if (app_path / "doc" / "screenshots").exists(): - screenshots = os.listdir(os.path.join(app_path, "doc", "screenshots")) + screenshots = [] + # only pick files (no folder) on the root of 'screenshots' + for entry in os.scandir(os.path.join(app_path, "doc", "screenshots")): + if os.DirEntry.is_file(entry): + screenshots.append(os.path.relpath(entry.path, app_path)) if ".gitkeep" in screenshots: screenshots.remove(".gitkeep") - else: - screenshots = [] disclaimer: Optional[str] if (app_path / "doc" / f"DISCLAIMER{lang_suffix}.md").exists(): diff --git a/readme_generator/templates/README.md.j2 b/readme_generator/templates/README.md.j2 index 8f51a41..46f33e4 100644 --- a/readme_generator/templates/README.md.j2 +++ b/readme_generator/templates/README.md.j2 @@ -42,7 +42,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Screenshots {% for screenshot in screenshots -%} - ![Screenshot of {{manifest.name}}](./doc/screenshots/{{screenshot}}) + ![Screenshot of {{manifest.name}}](./{{screenshot}}) {% endfor %} {% endif -%} diff --git a/readme_generator/templates/README_fr.md.j2 b/readme_generator/templates/README_fr.md.j2 index b02a7b8..fba3e1b 100644 --- a/readme_generator/templates/README_fr.md.j2 +++ b/readme_generator/templates/README_fr.md.j2 @@ -28,7 +28,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po ## Captures d’écran {% for screenshot in screenshots -%} - ![Capture d’écran de {{manifest.name}}](./doc/screenshots/{{screenshot}}) + ![Capture d’écran de {{manifest.name}}](./{{screenshot}}) {% endfor %} {% endif -%}