fix: read targets from the config's own tree

resolve_platform_cores and offer_boards read the RetroArch and platform
targets under the repository, whatever --platforms-dir a run was given,
behind a process-long cache. load_platform_config now records the
directory it read (_platforms_dir), the resolver reads targets from it,
the cache is keyed on that directory, and downloadable_on takes it from
its callers. The key is kept out of the published registry export.
This commit is contained in:
Abdessamad Derraz committed 2026-11-21 16:43:46 +01:00
1 parent 6aca93231a
commit 8780398518
7 files changed
+69 -22

No files matched your search

+12 -1
View File
@@ -4,13 +4,23 @@ from __future__ import annotations
import os
from core.paths import PLATFORMS_DIR, comparable_destination
from core.paths import PLATFORMS_DIR, REPO_ROOT, comparable_destination
from model.sources import source_yaml_file
_shared_yml_cache: dict[str, dict] = {}
_platform_config_cache: dict[tuple[str, str], dict] = {}
# The directory a config was loaded from, read by the steps that consult
# its other files (the RetroArch targets of a downloaded-only core).
PLATFORMS_DIR_KEY = "_platforms_dir"
def config_platforms_dir(config: dict) -> str:
"""The directory a config was loaded from, the repository's for a config
built by hand."""
return str(config.get(PLATFORMS_DIR_KEY) or REPO_ROOT / PLATFORMS_DIR)
def _inherited_yaml(platform_name: str, platforms_dir: str) -> tuple[dict, list[str]]:
"""The platform's YAML merged over its parents', and the chain of names.
@@ -233,6 +243,7 @@ def load_platform_config(platform_name: str, platforms_dir: str = PLATFORMS_DIR)
# The registry key, which per-platform profile fields (installed_on,
# not_bundled_on) name: the display name differs (MiSTer FPGA).
config["_key"] = platform_name
config[PLATFORMS_DIR_KEY] = platforms_dir
_attach_rom_folders(config, platform_name, platforms_dir)
_platform_config_cache[cache_key] = config
return config