refactor: move es_systems readers out of batocera

es_systems.yml readers move to scraper/es_systems.py, which the board
target scraper imports at load time instead of inside a function to dodge
the cycle. The _default.remove_cores list is target override data: it is
model.targets.not_cores, no longer a private name of batocera_scraper.
This commit is contained in:
Abdessamad Derraz committed 2026-11-21 16:43:46 +01:00
1 parent 14cc76132f
commit e6295aba88
12 files changed
+174 -167

No files matched your search

@@ -24,7 +24,7 @@ from datetime import datetime, timezone
from . import BaseTargetScraper, target_cli
from ..amberelec_scraper import BUILDS_OF, ES_SYSTEMS_TEMPLATE, RUNNERS
from ..base_scraper import fetch_text
from ..batocera_scraper import _not_cores
from model.targets import not_cores
from ..es_emulators import es_cores, xml_systems
PLATFORM_NAME = "amberelec"
@@ -91,7 +91,7 @@ def device_cores(es_systems: str, extra: list[str], keeps_extra: bool) -> list[s
"""Every core and standalone emulator one device's es_systems.cfg offers."""
text = es_systems if keeps_extra else without_cores(es_systems, extra)
cores, _standalone, _dual = es_cores(
xml_systems(text), RUNNERS, BUILDS_OF, _not_cores(PLATFORM_NAME)
xml_systems(text), RUNNERS, BUILDS_OF, not_cores(PLATFORM_NAME)
)
return sorted(set(cores))
@@ -23,6 +23,7 @@ from datetime import datetime, timezone
from . import BaseTargetScraper, target_cli
from ..base_scraper import fetch_present, fetch_text, github_json, github_tree, submodule_commit
from ..es_systems import es_systems_entries
PLATFORM_NAME = "batocera"
@@ -256,9 +257,6 @@ def _parse_es_systems(text: str) -> dict[str, list[str]]:
machines under their name, and the package that builds a machine builds
the emulator.
"""
# Imported here: batocera_scraper imports this module at load time.
from ..batocera_scraper import es_systems_entries
package_to_emulators: dict[str, list[str]] = {}
for _system, emulator, core, spec in es_systems_entries(text):
require = spec.get("requireAnyOf", []) if spec else None
@@ -34,7 +34,7 @@ from typing import NamedTuple
from . import BaseTargetScraper, target_cli
from ..base_scraper import fetch_text, github_json
from ..batocera_scraper import _not_cores
from model.targets import not_cores
from ..emuelec_systems import (
BUILDS_OF,
ES_SYSTEMS_TEMPLATE,
@@ -567,7 +567,7 @@ def device_cores(
):
installed.update(install.cores)
offered, _standalone, _dual = es_cores(
systems, RUNNERS, BUILDS_OF, _not_cores(PLATFORM_NAME)
systems, RUNNERS, BUILDS_OF, not_cores(PLATFORM_NAME)
)
return sorted(installed & set(offered))
@@ -575,7 +575,7 @@ def device_cores(
def check_names(systems: SystemEmulators) -> None:
"""Every ES core name is installed by a package read or known unbuilt."""
offered, _standalone, _dual = es_cores(
systems, RUNNERS, BUILDS_OF, _not_cores(PLATFORM_NAME)
systems, RUNNERS, BUILDS_OF, not_cores(PLATFORM_NAME)
)
provided = {core for installs in PROVIDERS.values() for i in installs for core in i.cores}
unread = sorted(set(offered) - provided - set(UNBUILT))