feat: lay out standalone files by build mode

This commit is contained in:
Abdessamad Derraz committed 2026-10-04 16:35:59 +02:00
1 parent 6148ab2e55
commit 887fc34bf6
8 files changed
+107 -37

No files matched your search

+21
View File
@@ -6184,5 +6184,26 @@ struct BurnDriver BurnDrvneogeo = {
cross_reference.get_mame_clone_map = original
class StandaloneModeRequiresAStandaloneBuild(unittest.TestCase):
"""A platform names its standalone emulators by its own names, which can
equal the key of a libretro-only profile (Recalbox and Batocera both
call their standalone ScummVM ``scummvm``). Laid out standalone, such a
profile loses every ``path:`` and drops its files at the root."""
def test_libretro_only_profile_keeps_its_layout(self):
from common import runs_standalone
libretro_only = {"type": "libretro", "cores": ["scummvm"]}
dual = {"type": "standalone + libretro", "cores": ["dolphin"]}
standalone = {"type": "standalone", "cores": ["xemu"]}
named = {"scummvm", "dolphin", "xemu", "hatari"}
self.assertFalse(runs_standalone("scummvm", libretro_only, named))
self.assertTrue(runs_standalone("dolphin", dual, named))
self.assertTrue(runs_standalone("xemu", standalone, named))
self.assertTrue(runs_standalone("other-key", {"type": "standalone", "cores": ["hatari"]}, named))
self.assertFalse(runs_standalone("dolphin", dual, set()))
self.assertFalse(runs_standalone("dolphin", dual, {"pcsx2"}))
if __name__ == "__main__":
unittest.main()
+19
View File
@@ -188,5 +188,24 @@ class RetroPiePackageList(unittest.TestCase):
self.assertEqual(scraper.fetch_requirements(), [])
class RecalboxBuildMode(unittest.TestCase):
"""es_bios.xml names a libretro core as libretro/<name> and a standalone
emulator by its bare name: the prefix is the build mode, and a platform
that runs an emulator standalone must say so or the pack lays its files
out for the libretro build."""
def test_bare_names_are_the_standalone_emulators(self):
from scraper.recalbox_scraper import split_cores
cores, standalone = split_cores(
["libretro/uae", "amiberry", "", "dolphin", "libretro/dolphin", "libretro-hatari", "hatari"]
)
self.assertEqual(
cores,
["amiberry", "dolphin", "hatari", "libretro-hatari", "libretro/dolphin", "libretro/uae"],
)
self.assertEqual(standalone, ["amiberry", "dolphin", "hatari"])
if __name__ == "__main__":
unittest.main()
+14 -2
View File
@@ -393,7 +393,8 @@ class TestBuildModeDecidesWhoClaims(unittest.TestCase):
entry["mode"] = mode
if standalone_path:
entry["standalone_path"] = standalone_path
return {"ares": {"cores": ["ares"], "files": [entry]}}
return {"ares": {"type": "standalone + libretro", "cores": ["ares"],
"files": [entry]}}
def test_a_standalone_only_file_does_not_claim_a_core_slot(self):
conflicts = slots.find_conflicts(
@@ -428,7 +429,8 @@ class TestBuildModeDecidesWhoClaims(unittest.TestCase):
self.assertEqual(claims[0].destination, "elsewhere/IPL.bin")
def test_the_mode_follows_a_core_alias_not_only_the_profile_name(self):
profile = {"ares_core": {"cores": ["ares"],
profile = {"ares_core": {"type": "standalone + libretro",
"cores": ["ares"],
"files": [{"name": "IPL.bin",
"path": "GC/JAP/IPL.bin",
"mode": "standalone"}]}}
@@ -438,6 +440,16 @@ class TestBuildModeDecidesWhoClaims(unittest.TestCase):
)
self.assertEqual(len(conflicts), 1)
def test_a_profile_without_a_standalone_build_keeps_its_core_layout(self):
profile = {"ares": {"type": "libretro", "cores": ["ares"],
"files": [{"name": "IPL.bin",
"path": "GC/JAP/IPL.bin",
"standalone_path": "elsewhere/IPL.bin"}]}}
claims = slots.profile_claims(
profile, REGIONS_DB, standalone_cores={"ares"}
)
self.assertEqual(claims[0].destination, "GC/JAP/IPL.bin")
class TestProvenEvidence(unittest.TestCase):
"""What counts as proof that a claim is about content, not about a name."""