mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-06 01:53:56 -06:00
fix: file a device set under each of its systems
The site read an entry's system: only, so the 430 MAME entries that list systems: were filed under no section. It now reads common.entry_system_ids for an entry that names its own systems.
This commit is contained in:
1 parent
8c3e653234
commit
33db4e9c83
2 files changed
+22
-3
No files matched your search
@@ -47,6 +47,7 @@ from common import (
|
||||
GAME_DATA_TOPS,
|
||||
compute_composition,
|
||||
count_catalog_matched,
|
||||
entry_system_ids,
|
||||
list_registered_platforms,
|
||||
list_release_pack_platforms,
|
||||
load_platform_registry,
|
||||
@@ -6500,9 +6501,10 @@ def _profiles_on_disk() -> dict[str, dict]:
|
||||
|
||||
|
||||
def _entry_systems(emulator: str, entry: dict) -> list[str]:
|
||||
"""The system an entry is read for: its own, or its profile's only one."""
|
||||
if entry.get("system"):
|
||||
return [str(entry["system"])]
|
||||
"""The systems an entry is read for: its own `system:` or `systems:`
|
||||
(a MAME device set several systems load), else its profile's only one."""
|
||||
if entry.get("system") or entry.get("systems"):
|
||||
return entry_system_ids(entry, {})
|
||||
systems = (_profiles_on_disk().get(emulator) or {}).get("systems") or []
|
||||
return [str(systems[0])] if len(systems) == 1 else []
|
||||
|
||||
|
||||
@@ -304,5 +304,22 @@ class BuildCount(unittest.TestCase):
|
||||
self.assertIn("system ids linked", source)
|
||||
|
||||
|
||||
class AnEntryListingSystemsIsFiledUnderEach(unittest.TestCase):
|
||||
"""MAME declares a device set under `systems:`, the machines of several
|
||||
systems loading it. The site read only `system:`, so ym2608.zip was filed
|
||||
under neither Arcade nor NEC PC-88, and kept on pages it does not serve."""
|
||||
|
||||
def test_the_site_reads_the_common_rule(self):
|
||||
import generate_site as gs # noqa: PLC0415
|
||||
from common import entry_system_ids # noqa: PLC0415
|
||||
|
||||
entry = {"name": "ym2608.zip", "systems": ["arcade", "pc80"]}
|
||||
self.assertEqual(gs._entry_systems("mame", entry), ["arcade", "pc80"])
|
||||
self.assertEqual(
|
||||
gs._entry_systems("mame", entry), entry_system_ids(entry, {"systems": []})
|
||||
)
|
||||
self.assertEqual(gs._entry_systems("mame", {"name": "a", "system": "pc80"}), ["pc80"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user