fix: prove launcher records against run profiles

This commit is contained in:
Abdessamad Derraz committed 2026-11-21 21:42:19 +01:00
1 parent e36516f3b0
commit 1839916ca2
35 files changed
+179 -160

No files matched your search

+1 -1
View File
@@ -78,7 +78,7 @@ def doubled_destinations(
collisions = find_collisions(scraped, db, zip_contents, data_registry)
if not collisions:
return []
standalone = standalone_set(scraped)
standalone = standalone_set(scraped, profiles)
named: dict[str, list[tuple[str, dict, dict, bool]]] = {}
for key in sorted(resolve_platform_cores(scraped, profiles)):
profile = profiles[key]
+2 -2
View File
@@ -66,7 +66,7 @@ def platform_configs(platforms_dir: str, platforms: list[str] | None = None) ->
def global_report_scope(
configs: list[dict], db: dict,
configs: list[dict], db: dict, profiles: dict[str, dict],
) -> tuple[dict[str, set[str]], ReportScope]:
"""What a gap report over *configs* compares against: the names each
system declares, and the scope cross_reference reads.
@@ -101,7 +101,7 @@ def global_report_scope(
))
return declared, {
"all_declared": merged_platform_declarations(configs, db),
"standalone_cores": merged_standalone_set(configs),
"standalone_cores": merged_standalone_set(configs, profiles),
"folded_slots": folded,
"declared_contents": merged_platform_declared_contents(configs, db),
}
+2 -2
View File
@@ -70,13 +70,13 @@ def run_gap_report(args: argparse.Namespace, parser: argparse.ArgumentParser) ->
raise SystemExit(f"ERROR: {exc}") from None
profiles = {k: v for k, v in profiles.items() if k == emulator}
tree = tree_scope(args.platform, args.target, args.platforms_dir, profiles)
tree = tree_scope(args.platform, args.target, args.platforms_dir, profiles, all_profiles)
if not tree.profiles:
refuse_empty_scope(args, emulator, tree)
return
db = load_database(args.db)
report = scope_gaps(tree, db, args.platforms_dir, args.platform)
report = scope_gaps(tree, db, args.platforms_dir, args.platform, all_profiles)
launcher_reads, unproven = launcher_rows(
tree.selected, args.platforms_dir, db, all_profiles, registry, emulator,
)
+5 -2
View File
@@ -12,11 +12,14 @@ from packs.crossrefscope import TreeScope
from resolve.launchers import LauncherLayer, declared_destinations
def scope_gaps(tree: TreeScope, db: dict, platforms_dir: str, platform: str | None) -> dict:
def scope_gaps(
tree: TreeScope, db: dict, platforms_dir: str, platform: str | None,
all_profiles: dict[str, dict],
) -> dict:
"""Each profile of the scope with the files its platforms leave undeclared."""
platform_scope = tree.platform
declared, global_scope = global_report_scope(
platform_configs(platforms_dir, tree.selected), db)
platform_configs(platforms_dir, tree.selected), db, all_profiles)
global_scope["standalone_cores"] = tree.standalone_cores
data_names = build_supplemental_index()
return cross_reference(
+16 -8
View File
@@ -26,8 +26,12 @@ class PlatformScope:
def platform_scope(
platform: str, target: str | None, platforms_dir: str, profiles: dict[str, dict],
all_profiles: dict[str, dict],
) -> PlatformScope:
"""The scope of a --platform run, narrowed to its --target cores."""
"""The scope of a --platform run, narrowed to its --target cores.
*all_profiles* is every profile of the run, whatever --emulator keeps:
the launcher records are proven against them."""
# A typo ended in a traceback where verify and slots name the closest
# target, and is refused the way they refuse it.
target_cores = target_scope(
@@ -40,7 +44,7 @@ def platform_scope(
)
return PlatformScope(
{k: v for k, v in profiles.items() if k in relevant},
standalone_set(config),
standalone_set(config, all_profiles),
config,
relevant,
run_anywhere,
@@ -60,7 +64,7 @@ class TreeScope:
def target_platforms_scope(
target: str, platforms_dir: str, profiles: dict[str, dict],
target: str, platforms_dir: str, profiles: dict[str, dict], all_profiles: dict[str, dict],
) -> TreeScope:
"""--target without --platform: every platform that has the target, each
with the cores it builds for it, the way verify and generate_pack read
@@ -75,28 +79,32 @@ def target_platforms_scope(
relevant |= set(resolve_platform_cores(config, profiles, target_cores=cache.get(name)))
return TreeScope(
{k: v for k, v in profiles.items() if k in relevant},
merged_standalone_set(configs.values()),
merged_standalone_set(configs.values(), all_profiles),
kept,
)
def tree_scope(
platform: str | None, target: str | None, platforms_dir: str, profiles: dict[str, dict],
all_profiles: dict[str, dict],
) -> TreeScope:
"""The scope --platform, --target or neither asks for."""
if platform:
scope = platform_scope(platform, target, platforms_dir, profiles)
scope = platform_scope(platform, target, platforms_dir, profiles, all_profiles)
return TreeScope(scope.profiles, scope.standalone_cores, [platform], scope)
if target:
return target_platforms_scope(target, platforms_dir, profiles)
return target_platforms_scope(target, platforms_dir, profiles, all_profiles)
# The tree as every platform runs it: a profile some platform runs
# standalone keeps its standalone entries. Laid out as libretro only,
# eka2l1, dolphin and xenia-edge lost 133 files no platform declares.
return TreeScope(
profiles,
merged_standalone_set(
load_platform_config(name, platforms_dir)
for name in list_registered_platforms(platforms_dir)
(
load_platform_config(name, platforms_dir)
for name in list_registered_platforms(platforms_dir)
),
all_profiles,
),
None,
)
+1 -1
View File
@@ -67,7 +67,7 @@ def core_data_trees(
if not data_registry:
return []
installed = installed_data_refs(platform_name)
handed = standalone_set(config)
handed = standalone_set(config, profiles)
# Relative to base_destination, which the members are written under. A
# platform with none writes its BIOS folder into every destination, and
# the trees go there as the core extras do.
+1 -1
View File
@@ -1535,7 +1535,7 @@ def collect_emulator_extras(
return extras
relevant = resolve_platform_cores(config, profiles, target_cores=target_cores)
standalone_set = platform_standalone_set(config)
standalone_set = platform_standalone_set(config, profiles)
by_name = db.get("indexes", {}).get("by_name", {})
# Build set of filenames already covered (platform baseline + first pass extras)
+2 -2
View File
@@ -484,7 +484,7 @@ def find_undeclared_files(
)
relevant = resolve_platform_cores(config, profiles, target_cores=target_cores)
standalone_set = platform_standalone_set(config)
standalone_set = platform_standalone_set(config, profiles)
# What the platform's own launchers open, matched to the cores it runs:
# the one decision the builder and this report both read.
launcher_layer = LauncherLayer(
@@ -647,6 +647,7 @@ def find_exclusion_notes(
platform_systems.add(sys_id)
relevant = resolve_platform_cores(config, profiles, target_cores=target_cores)
standalone_set = platform_standalone_set(config, profiles)
notes = []
for emu_name, profile in sorted(profiles.items()):
emu_systems = set(profile.get("systems", []))
@@ -682,7 +683,6 @@ def find_exclusion_notes(
# Count standalone-only files, but only report as excluded if the
# platform does NOT use this emulator in standalone mode
standalone_set = platform_standalone_set(config)
is_standalone = runs_standalone(emu_name, profile, standalone_set)
if not is_standalone:
standalone_files = [
+1 -1
View File
@@ -544,7 +544,7 @@ def slot_choices(
platform_profiles,
db,
config.get("base_destination", ""),
platform_standalone_set(config),
platform_standalone_set(config, profiles),
zip_contents,
data_dir_registry,
)
+1 -1
View File
@@ -29,7 +29,7 @@ def scan_platform(
relevant,
db,
config.get("base_destination", ""),
platform_standalone_set(config),
platform_standalone_set(config, profiles),
build_zip_contents_index(db) if zip_index is None else zip_index,
load_data_dir_registry(platforms_dir) if data_registry is None else data_registry,
)
+5 -3
View File
@@ -68,12 +68,14 @@ def platform_system(config: dict, system: str) -> str | None:
return matches[0] if matches else None
def libretro_build_runs(name: str, profile: dict, config: dict) -> bool:
def libretro_build_runs(
name: str, profile: dict, config: dict, profiles: dict[str, dict]
) -> bool:
"""The platform launches this profile's libretro build: it has one, and
the platform does not run the emulator standalone only."""
if "libretro" not in str(profile.get("type", "")) or profile.get("type") == "alias":
return False
standalone = standalone_set(config)
standalone = standalone_set(config, profiles)
if not runs_standalone(name, profile, standalone):
return True
dual = {c.removeprefix(DUAL_MODE_PREFIX) for c in standalone if c.startswith(DUAL_MODE_PREFIX)}
@@ -102,7 +104,7 @@ def choose_cores(config: dict, profiles: dict[str, dict], system: str, buildbot:
profile = profiles[name]
if wanted not in {norm_system_id(s) for s in profile.get("systems") or ()}:
continue
if not libretro_build_runs(name, profile, config):
if not libretro_build_runs(name, profile, config, profiles):
continue
out.extend(CoreChoice(name, so) for so in so_names(name, profile, buildbot, target))
return out
+2 -5
View File
@@ -8,8 +8,7 @@ import os
from model.platforms import load_platform_config
from model.sources import source_yaml_file
from resolve.layout import CORE_DIR_PREFIX
from resolve.standalone import standalone_set
from resolve.standalone import core_dir_tags
def group_identical_platforms(
@@ -66,9 +65,7 @@ def group_identical_platforms(
bool(config.get("case_insensitive_fs")),
# Where each core's files go: the same cores handed other
# folders make another pack.
sorted(
tag for tag in standalone_set(config) if tag.startswith(CORE_DIR_PREFIX)
),
sorted(core_dir_tags(config)),
]
fp = hashlib.sha1(f"{fp}|{emulators}".encode()).hexdigest()
if target_cores_cache:
+7 -28
View File
@@ -27,7 +27,6 @@ from model.profiles import lists_files, platform_builds, profile_names
from resolve.content import name_match_size_ok
from resolve.localfile import resolve_local_file
from core.paths import comparable_destination, sanitize_pack_path
from core.paths import REPO_ROOT
# The kinds whose names say which file the launcher opens. A link of a named
# file is one too: ROCKNIX links /storage/roms/bios/nds_bios_arm9.bin into
@@ -502,46 +501,27 @@ def config_evidence(
return ConfigEvidence(tuple(cited or [choices]), tuple(missing), tuple(readers))
_DEFAULT_PROFILES: dict[str, dict] | None = None
def _profiles_or_repo(profiles: Mapping[str, dict] | None) -> Mapping[str, dict]:
"""The profiles given, else this repository's, read once."""
global _DEFAULT_PROFILES
if profiles is not None:
return profiles
if _DEFAULT_PROFILES is None:
from model.profiles import load_emulator_profiles
_DEFAULT_PROFILES = load_emulator_profiles(
str(REPO_ROOT / "emulators")
)
return _DEFAULT_PROFILES
def _cites_config(record: dict) -> bool:
from resolve.launcherrefs import config_ref
return bool(record.get("choices_from")) or bool(config_ref(str(record.get("source_ref") or "")))
def bound_launchers(config: dict, profiles: Mapping[str, dict] | None = None) -> list[dict]:
def bound_launchers(config: dict, profiles: Mapping[str, dict]) -> list[dict]:
"""The launcher records a platform's packs, manifests and reports consume.
A record resting on a config file binds only when config_evidence holds
for it. The repository's profiles are read only when a record cites one.
for it against the run's profiles.
"""
records = [r for r in config.get("launchers") or [] if isinstance(r, dict)]
if not any(_cites_config(r) for r in records):
return records
known = _profiles_or_repo(profiles)
platform = str(config.get("_key") or "")
return [r for r in records if config_evidence(r, known, platform).proven]
return [r for r in records if config_evidence(r, profiles, platform).proven]
def launcher_unproven(
configs: Mapping[str, dict], profiles: Mapping[str, dict] | None = None
configs: Mapping[str, dict], profiles: Mapping[str, dict]
) -> list[dict]:
"""The records resting on a config file whose evidence does not hold.
@@ -553,9 +533,8 @@ def launcher_unproven(
records = [r for r in config.get("launchers") or [] if isinstance(r, dict)]
if not any(_cites_config(r) for r in records):
continue
known = _profiles_or_repo(profiles)
for index, record in enumerate(records):
evidence = config_evidence(record, known, str(config.get("_key") or platform))
evidence = config_evidence(record, profiles, str(config.get("_key") or platform))
if evidence.proven:
continue
rows.append({
@@ -582,7 +561,7 @@ def _place_paths(name: str, directories: list[str] | None) -> tuple[str, ...]:
def launcher_places(
config: dict, profiles: Mapping[str, dict] | None = None
config: dict, profiles: Mapping[str, dict]
) -> list[LauncherPlace]:
"""Every place a platform's launchers open a named file from."""
base = str(config.get("base_destination") or "bios")
@@ -810,7 +789,7 @@ def _listed_directories(raw: str) -> list[str] | None:
def handed_directories(
config: dict, profiles: Mapping[str, dict] | None = None
config: dict, profiles: Mapping[str, dict]
) -> list[HandedDirectory]:
"""Every whole directory a platform links or passes to a standalone build.
+1 -1
View File
@@ -765,8 +765,8 @@ def _attach_runners(systems: dict[str, NativeSystem], scraped: dict | None) -> N
standalone = {str(c) for c in scraped.get("standalone_cores") or []}
# The build decision reads the tagged set (own builds, twins), as the
# pack does. The runner's name is looked up among the plain names.
layout_set = standalone_set(scraped)
profiles = load_emulator_profiles(str(REPO_ROOT / "emulators"))
layout_set = standalone_set(scraped, profiles)
for system in systems.values():
for fe in system.files:
if fe.platform is not None or not fe.truth:
+17 -10
View File
@@ -78,12 +78,23 @@ def twin_build_names(config: dict) -> set[str]:
return found
def standalone_set(config: dict) -> set[str]:
def core_dir_tags(config: dict) -> set[str]:
"""The system directory a platform hands each core, tagged."""
return {
CORE_DIR_PREFIX + json.dumps([str(core), directory])
for directory, entry in (config.get("core_system_dirs") or {}).items()
for core in entry.get("cores") or []
}
def standalone_set(config: dict, profiles: Mapping[str, dict]) -> set[str]:
"""The emulators a platform launches standalone, with its dual-mode ones.
``dual_mode_cores`` names those it offers both ways (Batocera lists
libretro:dolphin and standalone dolphin for GameCube). They travel in the
same set, tagged, so every reader of standalone_cores sees them.
same set, tagged, so every reader of standalone_cores sees them. A
launcher record resting on a config file is proven against *profiles*,
the run's, as cross-reference proves it.
"""
names = {str(c) for c in config.get("standalone_cores") or []}
names |= {DUAL_MODE_PREFIX + str(c) for c in config.get("dual_mode_cores") or []}
@@ -100,15 +111,11 @@ def standalone_set(config: dict) -> set[str]:
names |= {DUAL_MODE_PREFIX + n for n in twin_build_names(config)}
# The system directory each core is handed travels the same way, so
# platform_layouts places a core's files below it for every reader.
names |= {
CORE_DIR_PREFIX + json.dumps([str(core), directory])
for directory, entry in (config.get("core_system_dirs") or {}).items()
for core in entry.get("cores") or []
}
names |= core_dir_tags(config)
if names - {n for n in names if n.startswith(CORE_DIR_PREFIX)}:
from resolve.launchers import executed_files, handed_directories
handed = handed_directories(config)
handed = handed_directories(config, profiles)
# The record's position travels too: a search list is read in order.
names |= {
HANDED_PREFIX + json.dumps(
@@ -144,7 +151,7 @@ def standalone_set(config: dict) -> set[str]:
return names | content_folder_tags(config)
def merged_standalone_set(configs: Iterable[dict]) -> set[str]:
def merged_standalone_set(configs: Iterable[dict], profiles: Mapping[str, dict]) -> set[str]:
"""The standalone set of several platforms read as one tree.
A per-core directory marker says which cores one platform hands a folder
@@ -155,7 +162,7 @@ def merged_standalone_set(configs: Iterable[dict]) -> set[str]:
return {
tag
for config in configs
for tag in standalone_set(config)
for tag in standalone_set(config, profiles)
if not tag.startswith((CORE_DIR_PREFIX, *CONTENT_TAG_PREFIXES))
}
+1 -1
View File
@@ -806,7 +806,7 @@ def generate_platform_truth(
# The layout rule verify and the pack builder apply: truth guessed its
# own from the profile type where the platform names no standalone
# emulator, and kept files the pack never carries.
standalone_set = platform_standalone_set(config)
standalone_set = platform_standalone_set(config, profiles)
resolved = resolve_platform_cores(config, profiles, target_cores)
+1 -1
View File
@@ -250,7 +250,7 @@ def build_emulator_gap_report(
from packs.crossref import cross_reference as run_cross_reference, global_report_scope
declared, scope = global_report_scope(
[cov["config"] for cov in coverages.values()], db)
[cov["config"] for cov in coverages.values()], db, profiles)
unique_profiles = {
k: v
for k, v in profiles.items()
+7 -4
View File
@@ -346,18 +346,21 @@ PER_EMULATOR_STEM = "gaps-per-emulator"
NOT_COLLECTED_STEM = "gaps-not-collected"
def reading_platforms(emu_name: str, profile: dict, name: str,
def reading_platforms(emu_name: str, profiles: dict[str, dict], name: str,
configs: dict[str, dict]) -> set[str]:
"""Of the platforms running an emulator (name -> config), those whose
build of it reads the entry: BlastEm's cdbios.bin is read by the
standalone build only, and RetroBat hands that build other names."""
standalone build only, and RetroBat hands that build other names.
*profiles* is every profile of the run, the emulator's among them."""
from resolve.standalone import platform_layouts, standalone_set
from resolve.validation import filter_files_by_mode, unread_on
profile = profiles[emu_name]
return {
platform for platform, config in configs.items()
if any(f.get("name") == name and not unread_on(f, platform)
for view, standalone in platform_layouts(emu_name, profile, standalone_set(config))
for view, standalone in platform_layouts(
emu_name, profile, standalone_set(config, profiles))
for f in filter_files_by_mode(view.get("files") or [], standalone))
}
@@ -575,7 +578,7 @@ def _source_row(m: dict, profiles: dict, coverages: dict,
emu_to_platforms: dict[str, set[str]], placer: sitewanted.Placer | None) -> str:
"""The row of one file to source."""
plats = sorted(set().union(
*(reading_platforms(key, profiles[key], m["name"], {
*(reading_platforms(key, profiles, m["name"], {
p: coverages[p]["config"] for p in emu_to_platforms.get(key, set())
}) for key in m["emu_keys"])
))
+5 -3
View File
@@ -11,6 +11,7 @@ from collections import Counter
from core.text import series
from model import siteinputs
from model.collection import profiles_in
from model.guides import GUIDES, TERMINALS, install_command
from model.platforms import load_platform_config
from model.registry import list_release_pack_platforms
@@ -186,13 +187,14 @@ def emulator_install_route(name: str, profile: dict) -> tuple[str, list[str], tu
def _standalone_cores(platform: str) -> frozenset[str]:
"""The emulators a setup launches as apps, by its platform file."""
return _standalone_cores_in(str(siteinputs.current().platforms), platform)
inputs = siteinputs.current()
return _standalone_cores_in(str(inputs.platforms), str(inputs.emulators), platform)
@functools.cache
def _standalone_cores_in(platforms_dir: str, platform: str) -> frozenset[str]:
def _standalone_cores_in(platforms_dir: str, emulators_dir: str, platform: str) -> frozenset[str]:
config = load_platform_config(platform, platforms_dir)
return frozenset(standalone_set(config))
return frozenset(standalone_set(config, profiles_in(emulators_dir, skip_aliases=True)))
def install_block(name: str, profile: dict) -> list[str]:
+2 -2
View File
@@ -121,7 +121,7 @@ def _launcher_refs(config: dict) -> dict[str, list[str]]:
# config file does not prove opens nothing: it is listed apart.
source = list_source(str(config.get("source") or ""))
found: dict[str, list[str]] = {}
for record in bound_launchers(config):
for record in bound_launchers(config, _site_profiles()):
if not isinstance(record, dict) or not record.get("source_ref"):
continue
text = (f"{escape_tags(str(record.get('emulator', '')))} at "
@@ -145,7 +145,7 @@ def launcher_unproven_section(config: dict) -> list[str]:
from resolve.launchers import launcher_unproven
from sitegen.sources import launcher_ref_markdown, list_source
rows = launcher_unproven({str(config.get("_key") or ""): config})
rows = launcher_unproven({str(config.get("_key") or ""): config}, _site_profiles())
if not rows:
return []
source = list_source(str(config.get("source") or ""))
+1 -1
View File
@@ -199,7 +199,7 @@ def wanted_declarations(profiles: dict, coverages: dict, gap_report: dict) -> li
found: list[dict] = []
for key, coverage in sorted(coverages.items()):
systems = coverage.get("config", {}).get("systems") or {}
standalone_cores = standalone_set(coverage.get("config", {}))
standalone_cores = standalone_set(coverage.get("config", {}), profiles)
by_system: dict[str, list[dict]] = {}
for detail in coverage.get("details", []):
by_system.setdefault(detail.get("system", ""), []).append(detail)
+3 -2
View File
@@ -4420,7 +4420,8 @@ class OpenMsxRomsSitInItsSystemroms(unittest.TestCase):
from scripts.model.platforms import load_platform_config
from scripts.resolve.standalone import platform_layouts, standalone_set
profile = load_emulator_profiles(str(ROOT / "emulators"))["openmsx"]
profiles = load_emulator_profiles(str(ROOT / "emulators"))
profile = profiles["openmsx"]
retrobat = yaml.safe_load((ROOT / "platforms" / "retrobat.yml").read_text())
declared_dirs = {
fe["destination"].rsplit("/", 1)[0].lower()
@@ -4430,7 +4431,7 @@ class OpenMsxRomsSitInItsSystemroms(unittest.TestCase):
}
self.assertEqual(declared_dirs, {"openmsx/share/systemroms"})
config = load_platform_config("retrobat", str(ROOT / "platforms"))
((view, _standalone),) = platform_layouts("openmsx", profile, standalone_set(config))
((view, _standalone),) = platform_layouts("openmsx", profile, standalone_set(config, profiles))
placed = {f["name"]: f for f in view["files"]}
for entry in profile["files"]:
with self.subTest(name=entry["name"]):
+1 -1
View File
@@ -135,7 +135,7 @@ class EveryReaderHasTheTreeOrAReason(unittest.TestCase):
unexplained = []
for platform in list_registered_platforms(platforms_dir):
config = load_platform_config(platform, platforms_dir)
handed = standalone_set(config)
handed = standalone_set(config, profiles)
for core in sorted(resolve_platform_cores(config, profiles)):
profile = profiles[core]
if all(standalone for _view, standalone
+1 -1
View File
@@ -39,7 +39,7 @@ class FlatDeclaredSet(unittest.TestCase):
}}
db = {"files": {}, "indexes": {"by_name": {}, "by_md5": {}, "by_crc32": {},
"by_path_suffix": {}}}
declared, scope = global_report_scope(platform_configs(str(platforms), ["fx"]), db)
declared, scope = global_report_scope(platform_configs(str(platforms), ["fx"]), db, profiles)
per_system = cross_reference(profiles, declared, db, set())
flat = cross_reference(
profiles, declared, db, set(), all_declared=scope["all_declared"],
+2 -2
View File
@@ -5853,10 +5853,10 @@ struct BurnDriver BurnDrvneogeo = {
# Keyed by the normalized system ID, as profiles spell systems
# differently from platforms.
db = {"files": {}, "indexes": {}}
everything, _ = global_report_scope(platform_configs(plat_dir), db)
everything, _ = global_report_scope(platform_configs(plat_dir), db, {})
self.assertEqual(everything["sharedsystem"], {"a.bin", "b.bin"})
only_alpha, _ = global_report_scope(platform_configs(plat_dir, ["alpha"]), db)
only_alpha, _ = global_report_scope(platform_configs(plat_dir, ["alpha"]), db, {})
self.assertEqual(only_alpha["sharedsystem"], {"a.bin"})
+5 -1
View File
@@ -16,6 +16,7 @@ from types import SimpleNamespace
import yaml
from model.platforms import load_platform_config
from model.profiles import load_emulator_profiles
from resolve.launchers import (
bound_launchers,
config_evidence,
@@ -394,7 +395,10 @@ class RepositoryRecords(unittest.TestCase):
)
for platform, emulator, directory in cases:
with self.subTest(platform=platform, emulator=emulator):
handed = handed_directories(load_platform_config(platform, str(platforms)))
handed = handed_directories(
load_platform_config(platform, str(platforms)),
load_emulator_profiles(str(REPO_ROOT / "emulators")),
)
self.assertIn(
directory, {h.directory for h in handed if h.emulator == emulator}
)
+5 -5
View File
@@ -156,7 +156,7 @@ class LauncherLayerTest(unittest.TestCase):
return set(zf.namelist())
def test_places_follow_the_launcher_order(self) -> None:
places = launcher_places(self.config)
places = launcher_places(self.config, self.profiles)
self.assertEqual(places[0].paths, ("a.bin", "b.bin", "c.bin"))
self.assertEqual(places[2].paths, ("sub/fix.bin",))
self.assertTrue(places[0].stands_for_default)
@@ -373,7 +373,7 @@ class LauncherLayerTest(unittest.TestCase):
self.config["launchers"][2].update(
kind="links", names=["fix.bin"], search_dir="/storage/roms/bios",
)
places = [p for p in launcher_places(self.config) if p.kind == "links"]
places = [p for p in launcher_places(self.config, self.profiles) if p.kind == "links"]
self.assertEqual([p.paths for p in places], [("fix.bin",)])
self.assertTrue(places[0].stands_for_default)
report = {u["path"]: u for u in self._report()}
@@ -384,7 +384,7 @@ class LauncherLayerTest(unittest.TestCase):
self.config["launchers"][2].update(
kind="links", names=[], search_dir="/userdata/bios/sub",
)
self.assertFalse([p for p in launcher_places(self.config) if p.kind == "links"])
self.assertFalse([p for p in launcher_places(self.config, self.profiles) if p.kind == "links"])
def test_the_platform_spelling_of_the_bios_folder_is_a_root(self) -> None:
"""RetroPie names $biosdir, EmuDeck ${biosPath}, RetroDECK $bios_path:
@@ -392,7 +392,7 @@ class LauncherLayerTest(unittest.TestCase):
for spelling in ("$biosdir", "${biosPath}", "$bios_path", "$HOME/RetroPie/bios"):
self.config["launchers"][2]["search_dir"] = f"{spelling}/sub"
with self.subTest(spelling=spelling):
self.assertEqual(launcher_places(self.config)[2].paths, ("sub/sub/fix.bin",))
self.assertEqual(launcher_places(self.config, self.profiles)[2].paths, ("sub/sub/fix.bin",))
def test_every_extractor_spelling_of_the_bios_folder_is_known(self) -> None:
from resolve import launchers
@@ -435,7 +435,7 @@ class LauncherLayerTest(unittest.TestCase):
selected = ["launchertest"]
declared, scope = global_report_scope(
platform_configs(self.platforms_dir, selected), self.db)
platform_configs(self.platforms_dir, selected), self.db, self.profiles)
layer = LauncherLayer(
self.config, self.profiles, self.profiles, self.db,
declared_destinations(self.config),
+10 -7
View File
@@ -88,7 +88,7 @@ class APatchRewritingAFolder(unittest.TestCase):
records(patched_paths({PATCH: PATCH_TEXT}.__getitem__))}
found = standalone_bindings(
{"citron"}, ["$XDG_DATA_HOME/citron", "CitronPath::KeysDir = keys"],
handed_directories(config),
handed_directories(config, {}),
)
self.assertEqual(found, {"keys": ("", "switch")})
@@ -114,7 +114,7 @@ class AFolderTheGeneratorEnters(unittest.TestCase):
config = {"base_destination": "bios", "standalone_cores": ["shadps4"],
"launchers": records(working_directories(self.tree()))}
found = standalone_bindings(
{"shadps4"}, ["getcwd/user", "$XDG_DATA_HOME/shadPS4"], handed_directories(config)
{"shadps4"}, ["getcwd/user", "$XDG_DATA_HOME/shadPS4"], handed_directories(config, {})
)
self.assertEqual(found, {"": ("outside", "")})
@@ -126,7 +126,7 @@ class AVariableADeclaredFolderIsSpelledFrom(unittest.TestCase):
"passes_to": "environment XDG_DATA_HOME", "source_ref": "x.py:1"}
config = {"base_destination": "bios", "standalone_cores": ["emu"], "launchers": [record]}
found = standalone_bindings(
{"emu"}, ["$XDG_DATA_HOME/emu"], handed_directories(config)
{"emu"}, ["$XDG_DATA_HOME/emu"], handed_directories(config, {})
)
self.assertEqual(found, {"": ("outside", "")})
@@ -136,7 +136,7 @@ class AVariableADeclaredFolderIsSpelledFrom(unittest.TestCase):
"passes_to": "environment XDG_DATA_HOME", "source_ref": "x.py:1"}
config = {"base_destination": "bios", "standalone_cores": ["emu"], "launchers": [record]}
found = standalone_bindings(
{"emu"}, ["$XDG_DATA_HOME/emu"], handed_directories(config)
{"emu"}, ["$XDG_DATA_HOME/emu"], handed_directories(config, {})
)
self.assertEqual(found, {"": ("", "data/emu")})
@@ -217,7 +217,7 @@ class APortableUserFolder(unittest.TestCase):
"launchers": rl.portable_users(self.sources())[:1],
}
found = standalone_bindings(
{"citron"}, ["$XDG_DATA_HOME/citron", "PORTABLE_DIR"], handed_directories(config)
{"citron"}, ["$XDG_DATA_HOME/citron", "PORTABLE_DIR"], handed_directories(config, {})
)
self.assertEqual(found, {"": ("emulators", "citron/user")})
@@ -324,11 +324,14 @@ class AUserFolderInTheConfigsFolder(unittest.TestCase):
from resolve.standalone import platform_layouts
from resolve.standalone import standalone_set
profile = load_emulator_profiles(str(REPO_ROOT / "emulators"))["shadps4"]
profiles = load_emulator_profiles(str(REPO_ROOT / "emulators"))
profile = profiles["shadps4"]
# KNULLI's generator does the same, but no KNULLI board builds shadps4.
for platform in ("batocera",):
config = load_platform_config(platform, str(REPO_ROOT / "platforms"))
((view, _standalone),) = platform_layouts("shadps4", profile, standalone_set(config))
((view, _standalone),) = platform_layouts(
"shadps4", profile, standalone_set(config, profiles)
)
with self.subTest(platform=platform):
self.assertEqual(
{(f.get("root"), f["standalone_path"].rsplit("/", 1)[0]) for f in view["files"]},
+25 -17
View File
@@ -203,8 +203,9 @@ class ALinkMovesTheDestination(unittest.TestCase):
# Without the working directory the link's $md_inst is not the
# directory the profile's paths are relative to.
config = {"standalone_cores": ["kick"], "launchers": [LINK]}
profile = load_emulator_profiles(str(self.emulators))["kick"]
(view, standalone), = platform_layouts("kick", profile, standalone_set(config))
profiles = load_emulator_profiles(str(self.emulators))
profile = profiles["kick"]
(view, standalone), = platform_layouts("kick", profile, standalone_set(config, profiles))
self.assertTrue(standalone)
self.assertNotIn("standalone_path", view["files"][0])
@@ -213,9 +214,10 @@ class UAE4AllOnRetroPie(unittest.TestCase):
"""The real profile against the real launcher records."""
def test_kickstarts_land_in_amiga(self) -> None:
profile = load_emulator_profiles(str(REPO_ROOT / "emulators"))["uae4all"]
profiles = load_emulator_profiles(str(REPO_ROOT / "emulators"))
profile = profiles["uae4all"]
config = load_platform_config("retropie", str(REPO_ROOT / "platforms"))
(view, standalone), = platform_layouts("uae4all", profile, standalone_set(config))
(view, standalone), = platform_layouts("uae4all", profile, standalone_set(config, profiles))
self.assertTrue(standalone)
for entry in view["files"]:
if entry["path"].startswith("kickstarts/"):
@@ -687,9 +689,10 @@ class AetherSX2OnKnulli(unittest.TestCase):
"""The real profile against KNULLI's aethersx2Generator.py:219 record."""
def test_the_bios_images_land_in_ps2(self) -> None:
profile = load_emulator_profiles(str(REPO_ROOT / "emulators"))["aethersx2"]
profiles = load_emulator_profiles(str(REPO_ROOT / "emulators"))
profile = profiles["aethersx2"]
config = load_platform_config("knulli", str(REPO_ROOT / "platforms"))
(view, standalone), = platform_layouts("aethersx2", profile, standalone_set(config))
(view, standalone), = platform_layouts("aethersx2", profile, standalone_set(config, profiles))
self.assertTrue(standalone)
for entry in view["files"]:
path = entry.get("path") or ""
@@ -703,9 +706,10 @@ class Quasi88OnRetroPie(unittest.TestCase):
"""RetroPie writes `-romdir` $biosdir/pc88 into quasi88.ini (quasi88.sh:67)."""
def test_the_roms_land_in_pc88(self) -> None:
profile = load_emulator_profiles(str(REPO_ROOT / "emulators"))["quasi88kai"]
profiles = load_emulator_profiles(str(REPO_ROOT / "emulators"))
profile = profiles["quasi88kai"]
config = load_platform_config("retropie", str(REPO_ROOT / "platforms"))
(view, standalone), = platform_layouts("quasi88kai", profile, standalone_set(config))
(view, standalone), = platform_layouts("quasi88kai", profile, standalone_set(config, profiles))
self.assertTrue(standalone)
paths = [e["path"] for e in view["files"]]
self.assertTrue(paths and all(p.startswith("rom/") for p in paths))
@@ -732,9 +736,10 @@ class FlycastOnEmuELEC(unittest.TestCase):
)
def test_the_bios_lands_in_dc(self) -> None:
profile = load_emulator_profiles(str(REPO_ROOT / "emulators"))["flycast"]
profiles = load_emulator_profiles(str(REPO_ROOT / "emulators"))
profile = profiles["flycast"]
config = load_platform_config("emuelec", str(REPO_ROOT / "platforms"))
layouts = platform_layouts("flycast", profile, standalone_set(config))
layouts = platform_layouts("flycast", profile, standalone_set(config, profiles))
(view,) = [v for v, standalone in layouts if standalone]
self.assertTrue(view["files"])
for entry in view["files"]:
@@ -742,9 +747,10 @@ class FlycastOnEmuELEC(unittest.TestCase):
def standalone_view(emulator: str, platform: str) -> dict:
profile = load_emulator_profiles(str(REPO_ROOT / "emulators"))[emulator]
profiles = load_emulator_profiles(str(REPO_ROOT / "emulators"))
profile = profiles[emulator]
config = load_platform_config(platform, str(REPO_ROOT / "platforms"))
(view,) = [v for v, standalone in platform_layouts(emulator, profile, standalone_set(config))
(view,) = [v for v, standalone in platform_layouts(emulator, profile, standalone_set(config, profiles))
if standalone]
return view
@@ -933,9 +939,10 @@ class LibretroMameSetsInMameBios(unittest.TestCase):
def test_retrobat_lays_out_both_builds(self) -> None:
# es_systems.cfg offers the libretro core mame and the standalone
# mame64, two names of one profile.
profile = load_emulator_profiles(str(REPO_ROOT / "emulators"))["mame"]
profiles = load_emulator_profiles(str(REPO_ROOT / "emulators"))
profile = profiles["mame"]
config = load_platform_config("retrobat", str(REPO_ROOT / "platforms"))
builds = sorted(s for _v, s in platform_layouts("mame", profile, standalone_set(config)))
builds = sorted(s for _v, s in platform_layouts("mame", profile, standalone_set(config, profiles)))
self.assertEqual(builds, [False, True])
@@ -1034,9 +1041,10 @@ class AdvanceMameOnEmuELEC(unittest.TestCase):
def libretro_view(emulator: str, platform: str) -> dict:
profile = load_emulator_profiles(str(REPO_ROOT / "emulators"))[emulator]
profiles = load_emulator_profiles(str(REPO_ROOT / "emulators"))
profile = profiles[emulator]
config = load_platform_config(platform, str(REPO_ROOT / "platforms"))
(view,) = [v for v, standalone in platform_layouts(emulator, profile, standalone_set(config))
(view,) = [v for v, standalone in platform_layouts(emulator, profile, standalone_set(config, profiles))
if not standalone]
return view
@@ -1227,7 +1235,7 @@ class AdvanceMameOnRetroPie(unittest.TestCase):
def test_the_sets_go_to_the_first_folder_searched(self) -> None:
config = load_platform_config("retropie", str(REPO_ROOT / "platforms"))
profiles = load_emulator_profiles(str(REPO_ROOT / "emulators"))
tags = standalone_set(config)
tags = standalone_set(config, profiles)
for emu in ("advmame", "advmame-1.4", "advmame-0.94"):
with self.subTest(emu=emu):
placed = [
+1 -1
View File
@@ -448,7 +448,7 @@ class TheWholeTreeKeepsCoresMinUILeavesOut(unittest.TestCase):
minui = {"core_system_dirs": {"Bios/FC": {"cores": ["fceumm"]}}}
retroarch = {}
merged = merged_standalone_set([minui, retroarch])
merged = merged_standalone_set([minui, retroarch], {})
profile = {"type": "libretro", "files": [{"name": "cgrom.tmp"}]}
layouts = platform_layouts("px68k", profile, merged)
self.assertEqual(layouts, [(profile, False)])
+6 -6
View File
@@ -89,16 +89,16 @@ class CoreChoice(unittest.TestCase):
def test_standalone_only_is_not_run_as_a_core(self) -> None:
both = {"type": "standalone + libretro", "cores": ["duckstation", "duckstation-sa"]}
self.assertTrue(packprobe.libretro_build_runs("duckstation", both, {}))
self.assertFalse(packprobe.libretro_build_runs("duckstation", both, {"standalone_cores": ["duckstation"]}))
self.assertTrue(packprobe.libretro_build_runs("duckstation", both, {}, {}))
self.assertFalse(packprobe.libretro_build_runs("duckstation", both, {"standalone_cores": ["duckstation"]}, {}))
self.assertTrue(packprobe.libretro_build_runs("duckstation", both, {
"standalone_cores": ["duckstation"], "dual_mode_cores": ["duckstation-sa"]}))
"standalone_cores": ["duckstation"], "dual_mode_cores": ["duckstation-sa"]}, {}))
# A buildbot core installable under the standalone name is its
# libretro build, run both ways (standalone_set).
self.assertTrue(packprobe.libretro_build_runs("duckstation", both, {
"standalone_cores": ["duckstation"], "installable_cores": ["duckstation"]}))
self.assertFalse(packprobe.libretro_build_runs("x", {"type": "standalone"}, {}))
self.assertFalse(packprobe.libretro_build_runs("x", {"type": "alias"}, {}))
"standalone_cores": ["duckstation"], "installable_cores": ["duckstation"]}, {}))
self.assertFalse(packprobe.libretro_build_runs("x", {"type": "standalone"}, {}, {}))
self.assertFalse(packprobe.libretro_build_runs("x", {"type": "alias"}, {}, {}))
def test_buildbot_name(self) -> None:
buildbot = {"mednafen_psx", "mednafen_psx_hw", "kronos"}
+1 -1
View File
@@ -120,7 +120,7 @@ class BundledFilesAreNotToSource(unittest.TestCase):
configs[name] = config
self.assertIn("retroarch", configs)
self.assertIn("retrobat", configs)
found = gaps.reading_platforms("blastem", profile, "cdbios.bin", configs)
found = gaps.reading_platforms("blastem", {"blastem": profile}, "cdbios.bin", configs)
self.assertFalse(found & {"retroarch", "lakka", "retrobat"}, found)
+36 -34
View File
@@ -36,6 +36,8 @@ from resolve.launchers import (
)
REPO_ROOT = Path(__file__).resolve().parent.parent
# The real launcher records are proven against the real profiles.
REPO_PROFILES = load_emulator_profiles(str(REPO_ROOT / "emulators"))
def link(emulator: str, search_dir: str, passes_to: str, **fields: object) -> dict:
@@ -68,7 +70,7 @@ def config(*launchers: dict, base: str = "bios") -> dict:
def standalone_view(cfg: dict) -> dict:
views = platform_layouts("emu", PROFILE, standalone_set(cfg))
views = platform_layouts("emu", PROFILE, standalone_set(cfg, {}))
return next(view for view, standalone in views if standalone)
@@ -86,7 +88,7 @@ class HandedDirectories(unittest.TestCase):
def test_retropie_variable_resolves_to_a_bios_folder(self) -> None:
found = handed_directories(config(
link("emu", "$biosdir/dc", "$home/.local/share/emu is a symlink to it"), base="BIOS",
))
), {})
self.assertEqual([h.folder for h in found], ["dc"])
self.assertIn("~/.local/share/emu", found[0].handles)
@@ -94,13 +96,13 @@ class HandedDirectories(unittest.TestCase):
found = handed_directories(config(
{**link("emu", "$biosdir", "$md_inst/<name>"), "names": ["boot.bin"]},
{**link("emu", "$bios_path/gc/EU", "$XDG_DATA_HOME/emu/GC/EUR"), "slot": "EUR"},
))
), {})
self.assertEqual(found, [])
def test_directory_outside_the_tree_has_no_folder(self) -> None:
found = handed_directories(config(
passes("emu", "/storage/roms/dreamcast/data", "find_user_data_dir() returns it"),
))
), {})
self.assertIsNone(found[0].folder)
@@ -111,7 +113,7 @@ class Root(unittest.TestCase):
def bindings(self, *launchers: dict, base: str = "bios") -> dict[str, tuple[str, str]]:
return standalone_bindings(
{"emu"}, PROFILE["standalone_directories"], handed_directories(config(*launchers, base=base))
{"emu"}, PROFILE["standalone_directories"], handed_directories(config(*launchers, base=base), {})
)
def test_link_of_the_data_directory_gives_its_folder(self) -> None:
@@ -159,7 +161,7 @@ class Root(unittest.TestCase):
def bind(cfg: dict, declared: list[str], pools: dict[str, str] | None = None,
systems: tuple[str, ...] = ()) -> dict[str, tuple[str, str]]:
return standalone_bindings(
{"emu"}, declared, handed_directories(cfg), pools=pools, systems=systems
{"emu"}, declared, handed_directories(cfg, {}), pools=pools, systems=systems
)
@@ -196,7 +198,7 @@ class SearchLists(unittest.TestCase):
# RetroDECK writes XRoar's rompath as four directories.
found = handed_directories(config(passes(
"emu", "$roms_path/coco:$roms_path/dragon32:$bios_path", "xroar.conf rompath",
)))
)), {})
self.assertEqual(
[h.directory for h in found], ["$roms_path/coco", "$roms_path/dragon32", "$bios_path"]
)
@@ -210,11 +212,11 @@ class SearchLists(unittest.TestCase):
# MAME splits its search paths on semicolons (src/emu/fileio.cpp:53-58).
found = handed_directories(config(passes(
"emu", "<romDirname>;/userdata/bios/mame;/userdata/bios", "command line -rompath",
)))
)), {})
self.assertEqual([h.folder for h in found], ["mame", ""])
found = handed_directories(config(passes(
"emu", "bios;<rom directory>", "command line -rp bios;<rom directory>",
)))
)), {})
self.assertEqual([(h.folder, "-rp" in h.handles) for h in found], [("", True)])
def test_a_list_holding_the_files_folder_keeps_them_there(self) -> None:
@@ -238,7 +240,7 @@ class SearchLists(unittest.TestCase):
)
def test_a_drive_letter_is_one_directory(self) -> None:
self.assertEqual(handed_directories(config(passes("emu", "C:/bios", "rompath"))), [])
self.assertEqual(handed_directories(config(passes("emu", "C:/bios", "rompath")), {}), [])
class AboveTheDeclaredDirectory(unittest.TestCase):
@@ -282,7 +284,7 @@ class PerSystem(unittest.TestCase):
"systems": {"coco": {"native_id": "trs80coco", "files": []}},
}
self.assertEqual(
[sorted(h.systems) for h in handed_directories(cfg)], [["coco"]]
[sorted(h.systems) for h in handed_directories(cfg, {})], [["coco"]]
)
def test_a_system_placeholder_gives_one_directory_per_system(self) -> None:
@@ -295,7 +297,7 @@ class PerSystem(unittest.TestCase):
},
}
self.assertEqual(
[(h.folder, sorted(h.systems)) for h in handed_directories(cfg)],
[(h.folder, sorted(h.systems)) for h in handed_directories(cfg, {})],
[("dragon", ["dragon64"]), ("trs80coco", ["coco"])],
)
self.assertEqual(bind(cfg, [], self.POOLS | {"-rompath": ""}, ("coco",)),
@@ -307,7 +309,7 @@ class PerSystem(unittest.TestCase):
**config({**passes("emu", "bios/coco", "-rompath"), "systems": ["coco"]}),
"systems": {"coco": {"files": [{"name": "coco3.rom", "native_system": "coco"}]}},
}
index = system_file_index(standalone_set(cfg))
index = system_file_index(standalone_set(cfg, {}))
self.assertEqual(
entry_launch_systems({"name": "COCO3.ROM", "system": "coco3"}, index),
frozenset({"coco3", "coco"}),
@@ -330,7 +332,7 @@ class SystemFamily(unittest.TestCase):
"systems": {"coco": {"native_id": "trs80coco",
"files": [{"name": "mc10.rom"}]}},
}
((view, _standalone),) = platform_layouts("emu", profile, standalone_set(cfg))
((view, _standalone),) = platform_layouts("emu", profile, standalone_set(cfg, {}))
self.assertEqual(
[f.get("standalone_path") for f in view["files"]],
["trs80coco/mc10.rom", "trs80coco/alice.rom"],
@@ -354,7 +356,7 @@ class OfferedMachine(unittest.TestCase):
),
"systems": {"coco": {"files": [{"name": "x.zip", "native_system": "coco"}]}},
}
((view, _standalone),) = platform_layouts("emu", profile, standalone_set(cfg))
((view, _standalone),) = platform_layouts("emu", profile, standalone_set(cfg, {}))
self.assertEqual(
[f.get("standalone_path") for f in view["files"]], ["coco/coco3.rom", "dragon/mc10.rom"]
)
@@ -380,7 +382,7 @@ class Layout(unittest.TestCase):
def test_libretro_view_keeps_path(self) -> None:
cfg = {**config(self.LINKED, base="BIOS"), "dual_mode_cores": ["emu"]}
views = platform_layouts("emu", PROFILE, standalone_set(cfg))
views = platform_layouts("emu", PROFILE, standalone_set(cfg, {}))
libretro = next(view for view, standalone in views if not standalone)
self.assertIs(libretro, PROFILE)
@@ -390,7 +392,7 @@ class Layout(unittest.TestCase):
cfg = {**config(link("emu", "$biosdir/emu", "$home/.local/share/emu is a symlink to it"),
base="BIOS"), "dual_mode_cores": ["emu"]}
views = dict((standalone, view) for view, standalone in
platform_layouts("emu", PROFILE, standalone_set(cfg)))
platform_layouts("emu", PROFILE, standalone_set(cfg, {})))
self.assertEqual(
[f["path"] for f in views[False]["files"]], ["dc/boot.bin", "dc/set.zip", "dc/shared.bin"]
)
@@ -399,9 +401,9 @@ class Layout(unittest.TestCase):
)
def test_union_of_platforms_with_two_folders_keeps_the_profile_layout(self) -> None:
union = standalone_set(config(self.LINKED, base="BIOS")) | standalone_set(config(
union = standalone_set(config(self.LINKED, base="BIOS"), {}) | standalone_set(config(
link("emu", "${biosPath}/emu/bios", "symlink ${biosPath}/emu/bios -> ${HOME}/.local/share/emu"),
))
), {})
self.assertEqual(standalone_bindings_for("emu", PROFILE, union), {})
def test_destination_function(self) -> None:
@@ -432,7 +434,7 @@ class FlycastOnEachPlatform(unittest.TestCase):
with self.subTest(platform=platform):
cfg = load_platform_config(platform, str(REPO_ROOT / "platforms"))
self.assertEqual(
standalone_bindings_for("flycast", self.profile, standalone_set(cfg)),
standalone_bindings_for("flycast", self.profile, standalone_set(cfg, REPO_PROFILES)),
{"": ("", folder)},
)
@@ -443,7 +445,7 @@ class FlycastOnEachPlatform(unittest.TestCase):
with self.subTest(platform=platform):
cfg = load_platform_config(platform, str(REPO_ROOT / "platforms"))
for view, standalone in platform_layouts(
"flycast", self.profile, standalone_set(cfg)
"flycast", self.profile, standalone_set(cfg, REPO_PROFILES)
):
if not standalone:
continue
@@ -461,7 +463,7 @@ class FlycastOnEachPlatform(unittest.TestCase):
self.assertIn("flycast", cfg.get("dual_mode_cores") or [])
views = {
standalone: view
for view, standalone in platform_layouts("flycast", self.profile, standalone_set(cfg))
for view, standalone in platform_layouts("flycast", self.profile, standalone_set(cfg, REPO_PROFILES))
}
self.assertEqual(set(views), {False, True})
for entry in views[False]["files"]:
@@ -592,7 +594,7 @@ class OpenmsxOnEachPlatform(unittest.TestCase):
with self.subTest(platform=platform):
cfg = load_platform_config(platform, str(REPO_ROOT / "platforms"))
self.assertEqual(
standalone_bindings_for("openmsx", self.profile, standalone_set(cfg)),
standalone_bindings_for("openmsx", self.profile, standalone_set(cfg, REPO_PROFILES)),
expected,
)
@@ -601,7 +603,7 @@ class OpenmsxOnEachPlatform(unittest.TestCase):
with self.subTest(platform=platform):
cfg = load_platform_config(platform, str(REPO_ROOT / "platforms"))
(view, _standalone), = platform_layouts(
"openmsx", self.profile, standalone_set(cfg)
"openmsx", self.profile, standalone_set(cfg, REPO_PROFILES)
)
for entry in view["files"]:
self.assertNotIn("unplaced", entry)
@@ -636,7 +638,7 @@ class XroarOnEachPlatform(unittest.TestCase):
def test_each_rom_lands_where_its_launch_reads_it(self) -> None:
for platform, folders in self.EXPECTED.items():
cfg = load_platform_config(platform, str(REPO_ROOT / "platforms"))
(view, _standalone), = platform_layouts("xroar", self.profile, standalone_set(cfg))
(view, _standalone), = platform_layouts("xroar", self.profile, standalone_set(cfg, REPO_PROFILES))
for entry in view["files"]:
with self.subTest(platform=platform, name=entry["name"]):
self.assertNotIn("unplaced", entry)
@@ -664,7 +666,7 @@ class AmiberryOnEachPlatform(unittest.TestCase):
with self.subTest(platform=platform):
cfg = load_platform_config(platform, str(REPO_ROOT / "platforms"))
self.assertEqual(
standalone_bindings_for(name, self.profiles[name], standalone_set(cfg)),
standalone_bindings_for(name, self.profiles[name], standalone_set(cfg, REPO_PROFILES)),
{"": ("", folder)},
)
@@ -672,7 +674,7 @@ class AmiberryOnEachPlatform(unittest.TestCase):
for platform, (name, folder) in self.BOUND.items():
profile = self.profiles[name]
cfg = load_platform_config(platform, str(REPO_ROOT / "platforms"))
views = platform_layouts(name, profile, standalone_set(cfg))
views = platform_layouts(name, profile, standalone_set(cfg, REPO_PROFILES))
((view, _standalone),) = [(v, s) for v, s in views if s]
for own, entry in zip(profile["files"], view["files"]):
if own.get("mode") == "libretro":
@@ -690,10 +692,10 @@ class AmiberryOnEachPlatform(unittest.TestCase):
profile = self.profiles[name]
cfg = load_platform_config("retrobat", str(REPO_ROOT / "platforms"))
self.assertEqual(
standalone_bindings_for(name, profile, standalone_set(cfg)),
standalone_bindings_for(name, profile, standalone_set(cfg, REPO_PROFILES)),
{"": ("emulators", "amiberry/ROMs"), "WHDBoot": ("emulators", "amiberry/WHDBoot")},
)
((view, _standalone),) = platform_layouts(name, profile, standalone_set(cfg))
((view, _standalone),) = platform_layouts(name, profile, standalone_set(cfg, REPO_PROFILES))
for own, entry in zip(profile["files"], view["files"]):
layout = own.get("standalone_path") or own.get("path") or own["name"]
folder = "amiberry" if layout.startswith("WHDBoot/") else "amiberry/ROMs"
@@ -744,7 +746,7 @@ class AmiberryBuildEachPlatformShips(unittest.TestCase):
cfg = load_platform_config(platform, str(REPO_ROOT / "platforms"))
if "amiberry" not in self.resolved(platform):
continue
layouts = platform_layouts("amiberry", self.profiles["amiberry"], standalone_set(cfg))
layouts = platform_layouts("amiberry", self.profiles["amiberry"], standalone_set(cfg, REPO_PROFILES))
with self.subTest(platform=platform):
self.assertEqual([standalone for _view, standalone in layouts], [False])
@@ -772,10 +774,10 @@ class AmiberryBuildEachPlatformShips(unittest.TestCase):
for name in ("amiberry-5.7.2", "amiberry-6.3.3"):
profile = self.profiles[name]
self.assertEqual(
standalone_bindings_for(name, profile, standalone_set(cfg)),
standalone_bindings_for(name, profile, standalone_set(cfg, REPO_PROFILES)),
{"kickstarts": ("", "amiga")},
)
((view, _standalone),) = platform_layouts(name, profile, standalone_set(cfg))
((view, _standalone),) = platform_layouts(name, profile, standalone_set(cfg, REPO_PROFILES))
for entry in view["files"]:
with self.subTest(name=name, file=entry["name"]):
if entry["path"].startswith("kickstarts/"):
@@ -791,10 +793,10 @@ class AmiberryBuildEachPlatformShips(unittest.TestCase):
profile = self.profiles["amiberry-5.6.5"]
cfg = load_platform_config("rocknix", str(REPO_ROOT / "platforms"))
self.assertEqual(
standalone_bindings_for("amiberry-5.6.5", profile, standalone_set(cfg)),
standalone_bindings_for("amiberry-5.6.5", profile, standalone_set(cfg, REPO_PROFILES)),
{"kickstarts": ("", "")},
)
((view, _standalone),) = platform_layouts("amiberry-5.6.5", profile, standalone_set(cfg))
((view, _standalone),) = platform_layouts("amiberry-5.6.5", profile, standalone_set(cfg, REPO_PROFILES))
for entry in view["files"]:
with self.subTest(name=entry["name"]):
if entry["path"].startswith("kickstarts/"):
+1 -1
View File
@@ -334,7 +334,7 @@ class CoreDownloaderReach(unittest.TestCase):
self.assertEqual(resolve_platform_cores(config, profiles), {"amiberry", "amiberry-7"})
self.assertEqual(resolve_platform_cores({**config, "installable_cores": []}, profiles),
{"amiberry-7"})
self.assertIn(DUAL_MODE_PREFIX + "amiberry", standalone_set(config))
self.assertIn(DUAL_MODE_PREFIX + "amiberry", standalone_set(config, profiles))
class DownloadedCoresReachTheirBoards(unittest.TestCase):
+1 -1
View File
@@ -260,7 +260,7 @@ class CrossReferenceReadsTheTargetAcrossPlatforms(unittest.TestCase):
platforms_dir = str(REPO_ROOT / "platforms")
profiles = load_emulator_profiles(str(REPO_ROOT / "emulators"))
with contextlib.redirect_stderr(io.StringIO()):
tree = tree_scope(None, "switch", platforms_dir, profiles)
tree = tree_scope(None, "switch", platforms_dir, profiles, profiles)
cache, kept, _notes = build_target_cores_cache(
list_registered_platforms(platforms_dir), "switch", platforms_dir, is_all=True,
)