refactor: move six command run modes to packages

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.
This commit is contained in:
Abdessamad Derraz committed 2026-11-21 15:47:20 +01:00
1 parent cff440613d
commit 48d88da168
16 files changed
+257 -229

No files matched your search

+2 -24
View File
@@ -27,32 +27,10 @@ sys.path.insert(0, os.path.dirname(__file__))
from model.database import load_optional_database
from core.cli import add_repo_inputs, require_directory
from resolve.review import load_platform_hashes, load_profile_hashes, validate_file
from resolve.reviewfiles import expand_folders, get_changed_files, place
from resolve.reviewfiles import files_to_validate, place
from resolve.reviewreport import json_rows, markdown_report, text_lines
def _files_to_validate(
args: argparse.Namespace, parser: argparse.ArgumentParser
) -> list:
"""The files named on the command line, or the changed ones."""
if args.changed and args.files:
# Named files were dropped for the git diff, and the run reported
# "No changed BIOS files detected" about files it never looked at.
parser.error("--changed reads the git diff: name files or pass --changed, not both")
if not args.changed:
if not args.files:
parser.error("No files specified. Use --changed or provide file paths.")
return expand_folders(args.files)
try:
files = get_changed_files()
except (RuntimeError, OSError) as exc:
print(f"Error: {exc}", file=sys.stderr)
sys.exit(2)
if not files and not args.json:
print("No changed BIOS files detected")
return files
def main() -> None:
parser = argparse.ArgumentParser(allow_abbrev=False, description="Validate BIOS file contributions")
parser.add_argument("files", nargs="*", help="Files to validate")
@@ -85,7 +63,7 @@ def main() -> None:
args.files = [os.path.abspath(f) for f in args.files]
work_from_repo_root(args, parser, ["db", "platforms_dir", "emulators_dir"])
files = _files_to_validate(args, parser)
files = files_to_validate(args, parser)
if not files:
if args.json:
print("[]")