mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-16 16:33:27 -05:00
fix: treat an empty platform system as named
This commit is contained in:
1 parent
3719de71b1
commit
06bf6d7c09
2 files changed
+23
-1
No files matched your search
@@ -265,6 +265,16 @@ def build_native_model(
|
||||
norm_to_scraped: dict[str, str] = {
|
||||
_norm_system_id(key): key for key in scraped_systems
|
||||
}
|
||||
# Every system the platform names, files or none: an addition elsewhere
|
||||
# is filed under our own slug.
|
||||
platform_ids = {
|
||||
native_id
|
||||
for key, sys_data in scraped_systems.items()
|
||||
for native_id in (
|
||||
sys_data.get("native_id") or key,
|
||||
*(_native_id_of(key, sys_data, fe) for fe in sys_data.get("files", [])),
|
||||
)
|
||||
}
|
||||
native_by_norm: dict[str, str] = {}
|
||||
for system in systems.values():
|
||||
native_by_norm.setdefault(_norm_system_id(system.native_id), system.native_id)
|
||||
@@ -431,7 +441,7 @@ def build_native_model(
|
||||
destination=destination,
|
||||
native_system=native_id,
|
||||
truth=truth_entry,
|
||||
foreign_system=not system.from_platform,
|
||||
foreign_system=native_id not in platform_ids,
|
||||
)
|
||||
)
|
||||
report.files_added += 1
|
||||
|
||||
@@ -917,6 +917,18 @@ class BatoceraExport(unittest.TestCase):
|
||||
)
|
||||
self.assertNotIn('"nintendo-snes"', produced["batocera-systems"])
|
||||
|
||||
def test_a_system_the_platform_names_without_files_is_its_own(self):
|
||||
"""A system the platform declares empty still has the platform's id."""
|
||||
scraped = {"systems": {"nintendo-snes": {"native_id": "snes", "files": []}}}
|
||||
truth = {"systems": {"nintendo-snes": {"files": [{
|
||||
"name": "st010.zip", "path": "st010.zip", "md5": "2" * 32,
|
||||
"required": False, "_cores": ["snes9x"],
|
||||
}]}}}
|
||||
systems, _ = build_native_model(truth, scraped)
|
||||
(entry,) = systems["snes"].files
|
||||
self.assertFalse(entry.foreign_system)
|
||||
self.assertTrue(discover_exporters()["batocera"]().writable(entry))
|
||||
|
||||
def test_writing_without_the_platform_file_is_refused(self):
|
||||
"""A systems dict alone is not the script Batocera runs."""
|
||||
systems, report = model()
|
||||
|
||||
Reference in new issue
Block a user