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

+3 -2
View File
@@ -16,6 +16,7 @@ import re
from dataclasses import dataclass, field
from pathlib import Path
from core.paths import EMULATORS_DIR, PLATFORMS_DIR
from model.systems import norm_system_id
from model.registry import list_registered_platforms
from model.profiles import load_emulator_profiles, preferred_profile, upstream_profile_index
@@ -97,7 +98,7 @@ class SystemResolver:
@classmethod
def from_repo(
cls, emulators_dir: str = "emulators", platforms_dir: str = "platforms"
cls, emulators_dir: str = EMULATORS_DIR, platforms_dir: str = PLATFORMS_DIR
) -> SystemResolver:
profiles = load_emulator_profiles(emulators_dir)
use: dict[str, int] = {}
@@ -159,7 +160,7 @@ class ProfileResolver:
index: dict[str, set[str]]
@classmethod
def from_repo(cls, emulators_dir: str = "emulators") -> ProfileResolver:
def from_repo(cls, emulators_dir: str = EMULATORS_DIR) -> ProfileResolver:
return cls(upstream_profile_index(load_emulator_profiles(emulators_dir)))
def resolve(self, core: str | None) -> str | None: