Files
libretro/scripts/generate_readme.py
T
Abdessamad Derraz ab7e300c19 refactor: tidy the repository root
README.md and CONTRIBUTING.md open with a comment naming their
generator, generate_readme.py --check fails on a hand edit in
validate.yml and pr_checks.py, and .gitattributes marks the pipeline
outputs as generated, held equal to core/generated.py by a test.

_mame_clones.json becomes mame_clones.json, still written beside the
scanned bios/ tree, and now triggers both workflows (coverage reads it).
docs_assets/ moves to website/assets/, which Astro does not read as
content. ACCESSIBILITY.md becomes wiki/accessibility.md, linked from the
README and the installer page. The screenshot list moves to
wiki/images-wanted.md: nothing read docs_assets/screens/.

The architecture map names every root entry (test_repository_map),
platforms/README.md keeps only what this folder holds, the reference
index lists archive-recipes and measurements, and reference-terms no
longer defines Profile twice nor repeats the glossary's Pack.
2026-11-24 10:40:25 +01:00

59 lines
1.8 KiB
Python

#!/usr/bin/env python3
"""Generate slim README.md from database.json and platform configs.
Detailed documentation lives on the site (abdess.github.io/retrobios/).
This script produces a concise landing page with download links and coverage.
Usage:
python scripts/generate_readme.py [--db database.json] [--platforms-dir platforms/]
"""
from __future__ import annotations
import argparse
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
from core.cli import add_repo_inputs
from model.database import load_database
from core.artifacts import repository_output_lock
from sitegen.readme import (
README_PATH,
check_readme,
load_readme_inputs,
render_readme,
write_readme,
)
def main() -> None:
parser = argparse.ArgumentParser(allow_abbrev=False, description="Generate slim README.md")
add_repo_inputs(parser, "db", "platforms")
parser.add_argument("--check", action="store_true",
help="exit 1 when README.md or CONTRIBUTING.md differs from what"
" the generator writes, writing nothing")
args = parser.parse_args()
import contextlib
from model.registry import load_data_dir_registry
from packs.datadirs import hold_data_dirs
db = load_database(args.db)
# Coverage resolves against data/: a refresh swapping a tree mid-read
# published counts taken from half of it.
with repository_output_lock(str(README_PATH)), contextlib.ExitStack() as held:
hold_data_dirs(held, load_data_dir_registry(args.platforms_dir))
inputs = load_readme_inputs(db, args.platforms_dir, args.db)
if args.check:
sys.exit(check_readme(render_readme(inputs)))
write_readme(render_readme(inputs))
if __name__ == "__main__":
from core.cli import run_cli
run_cli(main)