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

+22
View File
@@ -11,6 +11,8 @@ from typing import TYPE_CHECKING
from core.gitclone import compare_base, git_lines
if TYPE_CHECKING:
import argparse
from resolve.review import ValidationResult
@@ -65,6 +67,26 @@ def expand_folders(paths: list[str]) -> list[str]:
return out
def files_to_validate(args: argparse.Namespace, parser: argparse.ArgumentParser) -> list[str]:
"""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 place(results: list[ValidationResult]) -> list[str]:
"""Copy each placeable file to its destination, never over a file.