mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-22 17:47:48 -06:00
generate_db, generate_games_index, download, romset_recipes, validate_pr and list_platforms keep only main and build_parser: the database build goes to collection.run, the games index run to games.run, the pack info and its no-pack message to release.packinfo, the capture and build runs to romrecipes.runs, the file selection to resolve.reviewfiles. Tests reach the moved code through those packages.
39 lines
1.5 KiB
Python
39 lines
1.5 KiB
Python
"""One games index run: render, hold the coverage floor, then write or check install/games/."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import sys
|
|
|
|
from games.changes import describe_change
|
|
from games.coverage import floor_failures, print_coverage
|
|
from games.publish import pending, write
|
|
from games.render import render
|
|
|
|
|
|
def index(args: argparse.Namespace) -> int:
|
|
"""Render the index, then write it, or with --check name what would change."""
|
|
files, coverage = render(args.output_dir)
|
|
if not (args.quiet or args.check):
|
|
print_coverage(coverage, files)
|
|
failures = floor_failures(coverage)
|
|
for failure in failures:
|
|
print(f"FLOOR {failure}", file=sys.stderr)
|
|
changed, stale = pending(files, args.output_dir)
|
|
if args.check:
|
|
for path in changed:
|
|
print(f"STALE {path}", file=sys.stderr)
|
|
current = path.read_text(encoding="utf-8") if path.exists() else None
|
|
for line in describe_change(current, files[path]):
|
|
print(f" {line}", file=sys.stderr)
|
|
for path in stale:
|
|
print(f"STALE {path}", file=sys.stderr)
|
|
print(" no longer generated", file=sys.stderr)
|
|
if changed or stale:
|
|
print("Run python scripts/generate_games_index.py to write them.", file=sys.stderr)
|
|
return 1 if changed or stale or failures else 0
|
|
write(files, changed, stale)
|
|
print(f"{len(changed)} written, {len(stale)} removed")
|
|
return 1 if failures else 0
|
|
|