Skip to content

Commit

Permalink
move the screenshots code part to only run it once, since it do not c…
Browse files Browse the repository at this point in the history
…hange with language
  • Loading branch information
OniriCorpe committed Mar 13, 2024
1 parent 8c777e2 commit f3c2b77
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tools/readme_generator/make_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ def generate_READMEs(app_path: Path):

env = Environment(loader=FileSystemLoader(Path(__file__).parent / "templates"))

screenshots: List[str]
screenshots = []
if (app_path / "doc" / "screenshots").exists():
# 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):
# ignore '.gitkeep' or any file whose name begins with a dot
if not entry.name.startswith("."):
screenshots.append(os.path.relpath(entry.path, app_path))

# parse available README template and generate a list in the form of:
# > [("en", ""), ("fr", "_fr"), ...]
available_langs: List[Tuple[str, str]] = [("en", "")]
Expand Down Expand Up @@ -81,16 +91,6 @@ def generate_READMEs(app_path: Path):
else:
description = None

screenshots: List[str]
screenshots = []
if (app_path / "doc" / "screenshots").exists():
# 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):
# ignore '.gitkeep' or any file whose name begins with a dot
if not entry.name.startswith("."):
screenshots.append(os.path.relpath(entry.path, app_path))

disclaimer: Optional[str]
if (app_path / "doc" / f"DISCLAIMER{lang_suffix}.md").exists():
disclaimer = (app_path / "doc" / f"DISCLAIMER{lang_suffix}.md").read_text()
Expand Down

0 comments on commit f3c2b77

Please sign in to comment.