mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-22 17:47:48 -06:00
fix: guard target lists with board images
This commit is contained in:
1 parent
2b5955e8a5
commit
7222207f3b
3 files changed
+44
-1
No files matched your search
@@ -9,6 +9,7 @@ from collections.abc import Iterator
|
||||
from pathlib import Path
|
||||
|
||||
from core.artifacts import artifact_lock, repository_output_lock
|
||||
from packs.targets import is_target_list
|
||||
|
||||
|
||||
def json_artifact_kind(path: Path) -> str | None:
|
||||
@@ -23,7 +24,7 @@ def json_artifact_kind(path: Path) -> str | None:
|
||||
return None
|
||||
if "manifest_version" in data:
|
||||
return "manifest"
|
||||
if all(v is None or isinstance(v, list) for v in data.values()):
|
||||
if is_target_list(data):
|
||||
return "targets"
|
||||
return None
|
||||
|
||||
|
||||
@@ -29,6 +29,18 @@ def generate_target_manifests(targets_dir: str, output_dir: str) -> list[tuple[s
|
||||
return written
|
||||
|
||||
|
||||
def is_target_list(data: object) -> bool:
|
||||
"""Whether a decoded JSON document has the shape target_list writes:
|
||||
each target a core list, None, or its cores beside its board images."""
|
||||
return isinstance(data, dict) and bool(data) and all(
|
||||
held is None or isinstance(held, list) or (
|
||||
isinstance(held, dict) and set(held) == {"cores", "images"}
|
||||
and isinstance(held["cores"], list) and isinstance(held["images"], list)
|
||||
)
|
||||
for held in data.values()
|
||||
)
|
||||
|
||||
|
||||
def target_list(yml_file: Path) -> dict[str, list[str] | dict | None]:
|
||||
"""A platform's cores per hardware target, as install/targets/ publishes
|
||||
them and a pack carries them: aliases included, overrides applied."""
|
||||
|
||||
Reference in new issue
Block a user