From da19bb5755381009c4f7faa82d36d6f43832e742 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Thu, 5 Nov 2026 19:39:07 +0100 Subject: [PATCH] fix: keep MinUI core dirs out of the tree view Without --platform, cross_reference and the site's gap report merged every platform's standalone set, MinUI, NextUI and MyMinUI coredir: markers included. A marker says which cores one platform hands a folder, so in the union every core those three do not list got no layout: px68k showed 0 of 6 files and the global report lost 238 profiles and 1201 files. merged_standalone_set drops the markers, and both readers use it. --- scripts/common.py | 16 ++++++++++++++++ scripts/cross_reference.py | 8 ++++---- scripts/generate_site.py | 6 +++--- tests/test_minui_platform.py | 25 +++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 7 deletions(-) diff --git a/scripts/common.py b/scripts/common.py index 512dc944c..e773f562c 100644 --- a/scripts/common.py +++ b/scripts/common.py @@ -2446,6 +2446,22 @@ def standalone_set(config: dict) -> set[str]: return names +def merged_standalone_set(configs: Iterable[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 + and that it hands the others none. Carried into the union, MinUI's 86 + markers left every core they do not list without a layout: the global + gap report lost 238 profiles and 1201 files without a word. + """ + return { + tag + for config in configs + for tag in standalone_set(config) + if not tag.startswith(CORE_DIR_PREFIX) + } + + def _handed(standalone_cores: Iterable[str]) -> list: """The directories a standalone set carries, as launchers built them.""" from launchers import HandedDirectory # noqa: PLC0415 diff --git a/scripts/cross_reference.py b/scripts/cross_reference.py index 09b889989..abb464df6 100644 --- a/scripts/cross_reference.py +++ b/scripts/cross_reference.py @@ -1156,12 +1156,12 @@ def main() -> None: # 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. - from common import list_registered_platforms + from common import list_registered_platforms, merged_standalone_set - standalone_cores = set().union(*( - standalone_set(load_platform_config(name, args.platforms_dir)) + standalone_cores = merged_standalone_set( + load_platform_config(name, args.platforms_dir) for name in list_registered_platforms(args.platforms_dir, include_archived=True) - )) + ) if not profiles: if emulator and args.target and emulator in run_anywhere: diff --git a/scripts/generate_site.py b/scripts/generate_site.py index 5e3fb96a9..04724b67b 100644 --- a/scripts/generate_site.py +++ b/scripts/generate_site.py @@ -1159,7 +1159,7 @@ def build_emulator_gap_report( for k, v in profiles.items() if v.get("type") not in ("alias", "test") } - from common import platform_declarations, standalone_set + from common import merged_standalone_set, platform_declarations from validation import case_folded_slots # The command line passes these too: without them a RetroBat file named @@ -1171,8 +1171,8 @@ def build_emulator_gap_report( return run_cross_reference( unique_profiles, declared, db, data_names=data_names, all_declared=all_declared, - standalone_cores=set().union( - *(standalone_set(cov["config"]) for cov in coverages.values()) + standalone_cores=merged_standalone_set( + cov["config"] for cov in coverages.values() ), folded_slots=folded, ) diff --git a/tests/test_minui_platform.py b/tests/test_minui_platform.py index efccfc258..8807c22f4 100644 --- a/tests/test_minui_platform.py +++ b/tests/test_minui_platform.py @@ -439,5 +439,30 @@ class TheSitePageOfACardPlatform(unittest.TestCase): self.assertIn("No ZIP for MinUI. The command installs every file and checks it.", page) +class TheWholeTreeKeepsCoresMinUILeavesOut(unittest.TestCase): + """Without --platform, cross_reference and the site's gap report merge + every platform's standalone set. MinUI's per-core folders came along and + left every core MinUI does not list with no layout: px68k showed 0 files + and the global report lost 238 profiles.""" + + def test_a_core_minui_does_not_list_keeps_its_files(self): + from common import merged_standalone_set, platform_layouts + + minui = {"core_system_dirs": {"Bios/FC": {"cores": ["fceumm"]}}} + 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)]) + + def test_both_readers_build_the_set_the_same_way(self): + for script in ("cross_reference.py", "generate_site.py"): + source = (REPO_ROOT / "scripts" / script).read_text(encoding="utf-8") + with self.subTest(script=script): + self.assertIn("merged_standalone_set(", source) + self.assertNotIn("set().union(*(\n standalone_set(", source) + self.assertNotIn("*(standalone_set(cov", source) + + if __name__ == "__main__": unittest.main()