mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-04-13 12:22:33 -05:00
feat: propagate target_cores through find_undeclared_files, find_exclusion_notes, verify_platform, _collect_emulator_extras
This commit is contained in:
@@ -185,6 +185,7 @@ def _collect_emulator_extras(
|
||||
seen: set,
|
||||
base_dest: str,
|
||||
emu_profiles: dict | None = None,
|
||||
target_cores: set[str] | None = None,
|
||||
) -> list[dict]:
|
||||
"""Collect core requirement files from emulator profiles not in the platform pack.
|
||||
|
||||
@@ -198,7 +199,7 @@ def _collect_emulator_extras(
|
||||
"""
|
||||
from verify import find_undeclared_files
|
||||
|
||||
undeclared = find_undeclared_files(config, emulators_dir, db, emu_profiles)
|
||||
undeclared = find_undeclared_files(config, emulators_dir, db, emu_profiles, target_cores=target_cores)
|
||||
extras = []
|
||||
for u in undeclared:
|
||||
if not u["in_repo"]:
|
||||
|
||||
@@ -205,6 +205,7 @@ def find_undeclared_files(
|
||||
emulators_dir: str,
|
||||
db: dict,
|
||||
emu_profiles: dict | None = None,
|
||||
target_cores: set[str] | None = None,
|
||||
) -> list[dict]:
|
||||
"""Find files needed by cores but not declared in platform config."""
|
||||
# Collect all filenames declared by this platform
|
||||
@@ -226,7 +227,7 @@ def find_undeclared_files(
|
||||
by_name = db.get("indexes", {}).get("by_name", {})
|
||||
profiles = emu_profiles if emu_profiles is not None else load_emulator_profiles(emulators_dir)
|
||||
|
||||
relevant = resolve_platform_cores(config, profiles)
|
||||
relevant = resolve_platform_cores(config, profiles, target_cores=target_cores)
|
||||
standalone_set = set(str(c) for c in config.get("standalone_cores", []))
|
||||
undeclared = []
|
||||
seen = set()
|
||||
@@ -278,6 +279,7 @@ def find_undeclared_files(
|
||||
|
||||
def find_exclusion_notes(
|
||||
config: dict, emulators_dir: str, emu_profiles: dict | None = None,
|
||||
target_cores: set[str] | None = None,
|
||||
) -> list[dict]:
|
||||
"""Document why certain emulator files are intentionally excluded.
|
||||
|
||||
@@ -292,7 +294,7 @@ def find_exclusion_notes(
|
||||
for sys_id in config.get("systems", {}):
|
||||
platform_systems.add(sys_id)
|
||||
|
||||
relevant = resolve_platform_cores(config, profiles)
|
||||
relevant = resolve_platform_cores(config, profiles, target_cores=target_cores)
|
||||
notes = []
|
||||
for emu_name, profile in sorted(profiles.items()):
|
||||
emu_systems = set(profile.get("systems", []))
|
||||
@@ -368,6 +370,7 @@ def verify_platform(
|
||||
config: dict, db: dict,
|
||||
emulators_dir: str = DEFAULT_EMULATORS_DIR,
|
||||
emu_profiles: dict | None = None,
|
||||
target_cores: set[str] | None = None,
|
||||
) -> dict:
|
||||
"""Verify all BIOS files for a platform, including cross-reference gaps."""
|
||||
mode = config.get("verification_mode", "existence")
|
||||
@@ -452,8 +455,8 @@ def verify_platform(
|
||||
status_counts[s] = status_counts.get(s, 0) + 1
|
||||
|
||||
# Cross-reference undeclared files
|
||||
undeclared = find_undeclared_files(config, emulators_dir, db, emu_profiles)
|
||||
exclusions = find_exclusion_notes(config, emulators_dir, emu_profiles)
|
||||
undeclared = find_undeclared_files(config, emulators_dir, db, emu_profiles, target_cores=target_cores)
|
||||
exclusions = find_exclusion_notes(config, emulators_dir, emu_profiles, target_cores=target_cores)
|
||||
|
||||
return {
|
||||
"platform": platform,
|
||||
|
||||
@@ -1318,6 +1318,40 @@ class TestE2E(unittest.TestCase):
|
||||
result = resolve_platform_cores(config, profiles, target_cores=None)
|
||||
self.assertEqual(result, {"core_a", "core_b"})
|
||||
|
||||
def test_verify_target_filtered(self):
|
||||
"""Verify with target_cores only reports files from filtered cores."""
|
||||
self._write_target_fixtures()
|
||||
core_a_path = os.path.join(self.emulators_dir, "core_a.yml")
|
||||
core_b_path = os.path.join(self.emulators_dir, "core_b.yml")
|
||||
with open(core_a_path, "w") as f:
|
||||
yaml.dump({
|
||||
"emulator": "CoreA", "type": "libretro", "systems": ["sys1"],
|
||||
"files": [{"name": "bios_a.bin", "required": True}],
|
||||
}, f)
|
||||
with open(core_b_path, "w") as f:
|
||||
yaml.dump({
|
||||
"emulator": "CoreB", "type": "libretro", "systems": ["sys1"],
|
||||
"files": [{"name": "bios_b.bin", "required": True}],
|
||||
}, f)
|
||||
|
||||
config = {"cores": "all_libretro", "systems": {"sys1": {"files": []}}}
|
||||
profiles = load_emulator_profiles(self.emulators_dir)
|
||||
|
||||
# Without target: both cores' files are undeclared
|
||||
undeclared = find_undeclared_files(config, self.emulators_dir, self.db, profiles)
|
||||
names = {u["name"] for u in undeclared}
|
||||
self.assertIn("bios_a.bin", names)
|
||||
self.assertIn("bios_b.bin", names)
|
||||
|
||||
# With target filtering to core_a only
|
||||
undeclared = find_undeclared_files(
|
||||
config, self.emulators_dir, self.db, profiles,
|
||||
target_cores={"core_a"},
|
||||
)
|
||||
names = {u["name"] for u in undeclared}
|
||||
self.assertIn("bios_a.bin", names)
|
||||
self.assertNotIn("bios_b.bin", names)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user