mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-26 11:28:51 -06:00
fix: check every romfolders source_ref
model.romfolders.source_refs walks every ref a setup carries, offers[] and searched_by[] included, which the three hand lists in validate_schemas and the tests skipped: 4176 refs were never matched against the declared sources. validate_schemas parses them with split_refs and reports a malformed part.
This commit is contained in:
1 parent
ed19ae4198
commit
3467b80b38
4 files changed
+29
-26
No files matched your search
@@ -13,6 +13,7 @@ change to either reaches every setup without a rescrape.
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from collections.abc import Iterator
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
|
||||
@@ -41,6 +42,20 @@ def split_refs(source_ref: str) -> list[tuple[str, str, str | None]]:
|
||||
return parts
|
||||
|
||||
|
||||
def source_refs(doc: dict) -> Iterator[str]:
|
||||
"""Every source_ref a setup document carries, offers and searched_by included."""
|
||||
yield doc["roms_root"]["source_ref"]
|
||||
if doc.get("case_ref"):
|
||||
yield doc["case_ref"]
|
||||
for key in ("skip", "hidden", "media"):
|
||||
yield from (rule["source_ref"] for rule in doc.get(key) or ())
|
||||
for row in doc["folders"]:
|
||||
yield row["source_ref"]
|
||||
yield from (b["source_ref"] for b in (row.get("board_defaults") or {}).values())
|
||||
for key in ("offers", "searched_by"):
|
||||
yield from (item["source_ref"] for item in row.get(key) or () if item.get("source_ref"))
|
||||
|
||||
|
||||
def setup_paths(directory: Path = ROMFOLDERS_DIR) -> list[Path]:
|
||||
"""The setup files of a directory, without the sources file."""
|
||||
return sorted(p for p in Path(directory).glob("*.yml") if not p.name.startswith("_"))
|
||||
|
||||
Reference in new issue
Block a user