mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-06 01:53:56 -06:00
fix: badge only the platforms that read a file
This commit is contained in:
1 parent
5e9c2c87b6
commit
fbad34adbd
2 files changed
+40
-1
No files matched your search
@@ -10296,6 +10296,22 @@ def _upload_folder(profile: dict) -> str:
|
||||
return ""
|
||||
|
||||
|
||||
def reading_platforms(emu_name: str, profile: dict, name: str,
|
||||
configs: dict[str, dict]) -> set[str]:
|
||||
"""Of the platforms running an emulator (name -> config), those whose
|
||||
build of it reads the entry: BlastEm's cdbios.bin is read by the
|
||||
standalone build only, and RetroBat hands that build other names."""
|
||||
from common import platform_layouts, standalone_set # noqa: PLC0415
|
||||
from validation import filter_files_by_mode, unread_on # noqa: PLC0415
|
||||
|
||||
return {
|
||||
platform for platform, config in configs.items()
|
||||
if any(f.get("name") == name and not unread_on(f, platform)
|
||||
for view, standalone in platform_layouts(emu_name, profile, standalone_set(config))
|
||||
for f in filter_files_by_mode(view.get("files") or [], standalone))
|
||||
}
|
||||
|
||||
|
||||
def generate_gap_analysis(
|
||||
profiles: dict,
|
||||
coverages: dict,
|
||||
@@ -10627,6 +10643,7 @@ def generate_gap_analysis(
|
||||
for emu_name in matched:
|
||||
emu_to_platforms.setdefault(emu_name, set()).add(pname)
|
||||
|
||||
|
||||
# One row per file to find: a name two emulators share is one file
|
||||
# only when both declare the same hash. Keyed by name alone, Fallout
|
||||
# 2's master.dat vanished behind Fallout 1's, and the three Sonic
|
||||
@@ -10685,7 +10702,9 @@ def generate_gap_analysis(
|
||||
key=lambda x: (not x["required"], x["name"]),
|
||||
):
|
||||
plats = sorted(set().union(
|
||||
*(emu_to_platforms.get(key, set()) for key in m["emu_keys"])
|
||||
*(reading_platforms(key, profiles[key], m["name"], {
|
||||
p: coverages[p]["config"] for p in emu_to_platforms.get(key, set())
|
||||
}) for key in m["emu_keys"])
|
||||
))
|
||||
plat_badges = (
|
||||
" ".join(
|
||||
|
||||
@@ -8,6 +8,8 @@ import unittest
|
||||
from pathlib import Path
|
||||
from unittest import mock
|
||||
|
||||
import yaml
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(REPO_ROOT / "scripts"))
|
||||
|
||||
@@ -100,6 +102,24 @@ class BundledFilesAreNotToSource(unittest.TestCase):
|
||||
self.assertIn("| [ZQuest Classic](emulators/zq.md) | 4 | 1 | 0 | 0 | 2 | "
|
||||
'<span class="rb-badge rb-badge-danger">1</span> |', page)
|
||||
|
||||
def test_a_row_names_only_the_platforms_that_read_it(self):
|
||||
"""cdbios.bin, read by standalone BlastEm only and never on RetroBat,
|
||||
was badged retroarch, lakka and retrobat."""
|
||||
import generate_site
|
||||
from common import load_platform_config, resolve_platform_cores
|
||||
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
profile = yaml.safe_load((root / "emulators" / "blastem.yml").read_text(encoding="utf-8"))
|
||||
configs = {}
|
||||
for name in ("retroarch", "lakka", "retrobat", "batocera"):
|
||||
config = load_platform_config(name, str(root / "platforms"))
|
||||
if "blastem" in resolve_platform_cores(config, {"blastem": profile}):
|
||||
configs[name] = config
|
||||
self.assertIn("retroarch", configs)
|
||||
self.assertIn("retrobat", configs)
|
||||
found = generate_site.reading_platforms("blastem", profile, "cdbios.bin", configs)
|
||||
self.assertFalse(found & {"retroarch", "lakka", "retrobat"}, found)
|
||||
|
||||
|
||||
class StructuredBlocks(unittest.TestCase):
|
||||
PIN = "1e0de94dc7e669c0925a22c0fccf6cdc837af0a0"
|
||||
|
||||
Reference in new issue
Block a user