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

+7 -7
View File
@@ -34,7 +34,7 @@ amiga500:
class ThePlatformListsEveryOfferedCore(unittest.TestCase):
def test_libretro_cores_and_standalone_emulators(self):
from scripts.scraper.batocera_scraper import es_systems_emulators
from scripts.scraper.es_systems import es_systems_emulators
cores, standalone = es_systems_emulators(ES_SYSTEMS)
self.assertEqual(
@@ -43,9 +43,9 @@ class ThePlatformListsEveryOfferedCore(unittest.TestCase):
self.assertEqual(standalone, {"dosbox", "amiberry", "A500"})
def test_the_overrides_drop_the_machine_selectors(self):
from scripts.scraper.batocera_scraper import _not_cores
from model.targets import not_cores
self.assertIn("A500", _not_cores())
self.assertIn("A500", not_cores("batocera"))
def test_the_registry_leaves_the_list_to_the_scraper(self):
import yaml
@@ -60,7 +60,7 @@ class OneWalkReadsEsSystems(unittest.TestCase):
"""The scraper and the target scraper read es_systems.yml through one walk."""
def test_every_core_in_file_order(self):
from scripts.scraper.batocera_scraper import es_systems_entries
from scripts.scraper.es_systems import es_systems_entries
rows = [(s, e, c) for s, e, c, _spec in es_systems_entries(ES_SYSTEMS)]
self.assertEqual(rows, [
@@ -71,13 +71,13 @@ class OneWalkReadsEsSystems(unittest.TestCase):
])
def test_an_emulator_without_core_is_yielded_once(self):
from scripts.scraper.batocera_scraper import es_systems_entries
from scripts.scraper.es_systems import es_systems_entries
text = "x:\n emulators:\n vice:\n archs_include: [x86_64]\n"
self.assertEqual(list(es_systems_entries(text)), [("x", "vice", None, None)])
def test_a_file_that_is_not_a_mapping_is_refused(self):
from scripts.scraper.batocera_scraper import es_systems_entries
from scripts.scraper.es_systems import es_systems_entries
from scripts.scraper.targets.batocera_targets_scraper import _parse_es_systems
with self.assertRaises(ValueError):
@@ -102,7 +102,7 @@ class AnEmulatorLaunchedBothWaysGetsBothLayouts(unittest.TestCase):
dolphin-emu/Sys/GC/ files: no IPL, no DSP ROM."""
def test_the_scraper_names_dual_mode_emulators(self):
from scripts.scraper.batocera_scraper import es_systems_emulators, es_systems_libretro
from scripts.scraper.es_systems import es_systems_emulators, es_systems_libretro
text = ES_SYSTEMS + (
"gamecube:\n emulators:\n libretro:\n dolphin: { requireAnyOf: [X] }\n"
+2 -1
View File
@@ -268,6 +268,7 @@ class OnlyWhatABoardBuildsIsRun(unittest.TestCase):
def test_only_what_a_board_builds_or_the_user_supplies_is_run(self):
from scraper import batocera_scraper as bs
from scraper.es_systems import es_systems_by_system
# A board selects kodi's package and buildroot's mpv. Citron is
# listed by es_systems, so the symbol of a folder of that name does
@@ -281,7 +282,7 @@ class OnlyWhatABoardBuildsIsRun(unittest.TestCase):
self.assertEqual(sorted(standalone), ["kodi", "lexaloffle", "mpv", "vox_official"])
# Each system keeps the list es_systems.yml writes (whose files its
# entries ask for), less a default no package builds.
by_system = bs.es_systems_by_system(self.ES, self.DEFAULTS, set(), built)
by_system = es_systems_by_system(self.ES, self.DEFAULTS, set(), built)
self.assertEqual(by_system["switch"], ["citron"])
self.assertEqual(by_system["voxatron"], ["lexaloffle", "vox_official"])
self.assertEqual(by_system["gba"], ["mgba"])
+1 -1
View File
@@ -787,7 +787,7 @@ class TheScrapersReadTheSystemLists(unittest.TestCase):
"""libretro_systems, read from each platform's own system list."""
def test_batocera_and_knulli_es_systems_yml(self):
from scripts.scraper.batocera_scraper import es_systems_libretro_systems
from scripts.scraper.es_systems import es_systems_libretro_systems
text = (
"gamecube:\n emulators:\n dolphin:\n dolphin: { requireAnyOf: [A] }\n"