refactor: share CLI options and default paths

core.paths holds the default database, platforms, emulators and bios paths, core.cli declares the options built on them (add_repo_inputs) and the --emulator/--system modes verify and generate_pack share. model.targets.target_scope answers --target for a command line, model.profiles.no_profile_for_systems the system with no emulator. tests/sources.declared_options reads the options a script declares through either form.
This commit is contained in:
Abdessamad Derraz committed 2026-11-20 18:28:46 +01:00
1 parent 348d5b51c3
commit cf03dcb2ef
50 files changed
+260 -405

No files matched your search

+2 -16
View File
@@ -19,6 +19,7 @@ import sys
from dataclasses import dataclass
sys.path.insert(0, os.path.dirname(__file__))
from core.cli import add_repo_inputs
from model.cliargs import platform_arg, list_emulator_profiles, require_platform
from model.profiles import ProfileSelectionError, load_emulator_profiles, select_emulator_profiles
from model.database import load_database
@@ -34,7 +35,6 @@ from resolve.launchers import (
)
from packs.crossref import (
DEFAULT_PLATFORMS_DIR,
build_supplemental_index,
cross_reference,
declared_names,
@@ -46,9 +46,6 @@ from packs.crossref import (
yaml = require_yaml()
DEFAULT_EMULATORS_DIR = "emulators"
DEFAULT_DB = "database.json"
# The --json key of the launcher reads category, beside the emulator keys.
LAUNCHER_READS_KEY = "_launcher_reads_not_held"
@@ -187,18 +184,7 @@ def print_report(
def _build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(allow_abbrev=False, description="Emulator vs platform gap analysis")
parser.add_argument(
"--emulators-dir", default=DEFAULT_EMULATORS_DIR,
help="emulator profile directory (default: %(default)s)",
)
parser.add_argument(
"--platforms-dir", default=DEFAULT_PLATFORMS_DIR,
help="platform YAML directory (default: %(default)s)",
)
parser.add_argument(
"--db", default=DEFAULT_DB,
help="database file to read (default: %(default)s)",
)
add_repo_inputs(parser, "emulators", "platforms", "db")
parser.add_argument("--emulator", "-e", help="Analyze single emulator")
parser.add_argument(
"--platform", "-p", type=platform_arg, help="Restrict analysis to one platform's cores"