From 33db4e9c838f9137a28b765b379787cbb496c876 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Fri, 6 Nov 2026 03:15:39 +0100 Subject: [PATCH] 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. --- scripts/generate_site.py | 8 +++++--- tests/test_site_system_sections.py | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/scripts/generate_site.py b/scripts/generate_site.py index 6fe7b38ca..2380d3b5a 100644 --- a/scripts/generate_site.py +++ b/scripts/generate_site.py @@ -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 [] diff --git a/tests/test_site_system_sections.py b/tests/test_site_system_sections.py index 8a4d59583..4a3b4268e 100644 --- a/tests/test_site_system_sections.py +++ b/tests/test_site_system_sections.py @@ -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()