mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-20 18:59:07 -05:00
fix: raise on a registry missing a platform file
list_registered_platforms skipped a registered platform whose YAML was missing and returned an empty list without a registry. verify --all --strict, every --all build, the CI matrix and the site then ran over fewer platforms and exited 0, and install.py kept serving the stale manifest. Both now raise and name the file.
This commit is contained in:
1 parent
c42c756b4a
commit
9fa1f45e92
2 files changed
+29
-3
No files matched your search
+10
-3
@@ -411,10 +411,14 @@ def list_registered_platforms(
|
||||
|
||||
Only registered platforms generate packs and appear in CI.
|
||||
Unregistered YAMLs (e.g., emulatorjs.yml) are base configs for inheritance.
|
||||
|
||||
A missing registry, or a registered platform whose file is gone, raises:
|
||||
left out quietly, verify --all --strict and every --all build passed
|
||||
having checked none of it, and install.py kept serving its last manifest.
|
||||
"""
|
||||
registry_path = os.path.join(platforms_dir, "_registry.yml")
|
||||
if not os.path.exists(registry_path):
|
||||
return []
|
||||
raise FileNotFoundError(f"no platform registry at {registry_path}")
|
||||
with open(registry_path) as f:
|
||||
registry = yaml_load(f) or {}
|
||||
platforms = []
|
||||
@@ -423,8 +427,11 @@ def list_registered_platforms(
|
||||
if status == "archived" and not include_archived:
|
||||
continue
|
||||
config_path = os.path.join(platforms_dir, meta.get("config", f"{name}.yml"))
|
||||
if os.path.exists(config_path):
|
||||
platforms.append(name)
|
||||
if not os.path.exists(config_path):
|
||||
raise FileNotFoundError(
|
||||
f"{name} is registered in {registry_path} but {config_path} does not exist"
|
||||
)
|
||||
platforms.append(name)
|
||||
return platforms
|
||||
|
||||
|
||||
|
||||
@@ -5355,5 +5355,24 @@ class ThePackCheckAppliesTheFrontendRule(unittest.TestCase):
|
||||
self.assertIsNotNone(_check_member_hash(zf, "bios/x.bin", entry, "md5"))
|
||||
|
||||
|
||||
class ABrokenRegistryIsNotAnEmptyOne(unittest.TestCase):
|
||||
"""A registered platform whose YAML was renamed was skipped without a
|
||||
word, and a missing registry read as no platforms: verify --all --strict
|
||||
and every --all build passed having checked nothing."""
|
||||
|
||||
def test_both_raise(self):
|
||||
from scripts.common import list_registered_platforms
|
||||
|
||||
with tempfile.TemporaryDirectory(dir=TMP_ROOT) as tmp:
|
||||
with self.assertRaises(FileNotFoundError):
|
||||
list_registered_platforms(tmp)
|
||||
Path(tmp, "_registry.yml").write_text(
|
||||
"platforms:\n rocknix:\n config: rocknix.yml\n", encoding="utf-8"
|
||||
)
|
||||
with self.assertRaises(FileNotFoundError) as caught:
|
||||
list_registered_platforms(tmp)
|
||||
self.assertIn("rocknix", str(caught.exception))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user