refactor: group scraper modules by subject

scraper/ held the platform scrapers next to three other subjects. The
launcher readers move to scraper/launchers/ (their _launchers suffix
dropped), the MAME and FBNeo hash scrapers and romset importers to
scraper/arcade/, the DAT readers and dump catalog importers to
scraper/dats/. The buildbot check is a freshness check and moves to
freshness/buildbot.py. Every -m command, workflow job, schema
description and page follows.

The scraper discovery in scraper/__init__.py had no caller: the
registry's scraper: field names the module, and the pages now say so.
This commit is contained in:
Abdessamad Derraz committed 2026-11-24 10:22:26 +01:00
1 parent 4e01cff854
commit e1bad01b82
130 files changed
+445 -414

No files matched your search

+1 -1
View File
@@ -9,7 +9,7 @@ from __future__ import annotations
import tests
from scraper.recalbox_configgen import (
from scraper.launchers.recalbox_configgen import (
AMIBERRY_CONFIG,
AMIBERRY_GLOBAL,
AMIBERRY_KICKSTARTS,
+1 -1
View File
@@ -6,7 +6,7 @@ import tests
import textwrap
from scraper.csharp_source import Source
from scraper.launchers.csharp_source import Source
def placed(blocks: dict[int, str]) -> str:
+1 -1
View File
@@ -71,7 +71,7 @@ COMMANDS = {
"commit_rules.py": ("devtools/commitrules.py",),
"pr_checks.py": ("devtools/prchecks.py",),
"check_buildbot_system.py": (
"scraper/buildbot_system.py", "packs/datadirs.py", "packs/datadirextract.py",
"freshness/buildbot.py", "packs/datadirs.py", "packs/datadirextract.py",
),
"generate_site.py": (
"sitegen/config.py", "sitegen/emulatorsindex.py", "sitegen/places.py", "sitegen/home.py",
+5 -5
View File
@@ -11,11 +11,11 @@ import unittest
import zipfile
from pathlib import Path
from scripts.scraper import arcade_parent_importer as api
from scripts.scraper import arcade_drivers
from scripts.scraper import arcade_sets
from scripts.scraper import clex
from scripts.scraper import listxml
from scripts.scraper.arcade import arcade_parent_importer as api
from scripts.scraper.arcade import arcade_drivers
from scripts.scraper.arcade import arcade_sets
from scripts.scraper.arcade import clex
from scripts.scraper.dats import listxml
ROOT = Path(__file__).resolve().parent.parent
FIXTURES = ROOT / "tests" / "fixtures" / "arcade_parents"
+5 -5
View File
@@ -372,20 +372,20 @@ class ACheckThatCannotAnswerDoesNotPass(unittest.TestCase):
"""Every HEAD unanswered printed "16 unknown" and exited 0, so the
online pipeline printed check_buildbot OK."""
import check_buildbot_system as cbs
from scraper import buildbot_system
from freshness import buildbot
registry = str(REPO_ROOT / "platforms" / "_data_dirs.yml")
tracked = buildbot_system.load_tracked_entries(registry)
tracked = buildbot.load_tracked_entries(registry)
self.assertTrue(tracked)
cases = {
"index unreachable": mock.patch.object(
buildbot_system, "fetch_index", side_effect=OSError("down")),
buildbot, "fetch_index", side_effect=OSError("down")),
"every HEAD unanswered": mock.patch.object(
buildbot_system, "fetch_index", return_value=set(tracked)),
buildbot, "fetch_index", return_value=set(tracked)),
}
for label, index in cases.items():
with self.subTest(label), index, \
mock.patch.object(buildbot_system, "get_remote_etag", return_value=None), \
mock.patch.object(buildbot, "get_remote_etag", return_value=None), \
mock.patch.object(sys, "argv", ["check_buildbot_system.py",
"--registry", registry]), \
contextlib.redirect_stdout(io.StringIO()), \
+1 -1
View File
@@ -1135,7 +1135,7 @@ class CommentsSayWhy(unittest.TestCase):
cwd=REPO_ROOT, capture_output=True, text=True, check=True,
).stdout.split()
self.assertIn("install.py", tracked)
self.assertIn("scripts/scraper/mame_parser.py", tracked)
self.assertIn("scripts/scraper/arcade/mame_parser.py", tracked)
found = []
for name in sorted(set(tracked)):
lines = (REPO_ROOT / name).read_text(encoding="utf-8").splitlines()
+2 -2
View File
@@ -558,7 +558,7 @@ class TheCollectionShipsADat(unittest.TestCase):
converter from files.csv."""
def test_round_trip_through_the_logiqx_parser(self):
sys.path.insert(0, str(REPO_ROOT / "scripts" / "scraper"))
sys.path.insert(0, str(REPO_ROOT / "scripts" / "scraper" / "dats"))
from logiqx_parser import parse_logiqx
from scripts.sitegen.structured import collection_dat
@@ -581,7 +581,7 @@ class TheCollectionShipsADat(unittest.TestCase):
"""A Batocera user auditing share/bios against the collection DAT met
thousands of sets laid out by manufacturer, and nothing of the folder
Batocera reads."""
sys.path.insert(0, str(REPO_ROOT / "scripts" / "scraper"))
sys.path.insert(0, str(REPO_ROOT / "scripts" / "scraper" / "dats"))
from logiqx_parser import parse_logiqx
from scripts.sitegen.platformfiles import platform_data_links
from scripts.sitegen.structured import platform_dat
+3 -3
View File
@@ -274,7 +274,7 @@ class GithubTokenPerStep(Scratch):
return unattended_jobs.parse_jobs({"jobs": {name: {"steps": [{"run": run, "github_token": True}]}}})
def test_allowed_on_the_scrapers_and_freshness_scripts(self):
for run in ([PY, "-m", "scripts.scraper.mame_hash_scraper"],
for run in ([PY, "-m", "scripts.scraper.arcade.mame_hash_scraper"],
[PY, "scripts/check_freshness.py", "--json"],
[PY, "scripts/refresh_stale.py", "--only", "data"]):
with self.subTest(run=run):
@@ -293,11 +293,11 @@ class GithubTokenPerStep(Scratch):
def test_refused_in_the_campaign_job_even_on_a_scraper(self):
with self.assertRaisesRegex(ValueError, "campaign never receives"):
self.job([PY, "-m", "scripts.scraper.mame_hash_scraper"], name="campaign")
self.job([PY, "-m", "scripts.scraper.arcade.mame_hash_scraper"], name="campaign")
def test_an_undeclared_step_gets_no_token(self):
job = unattended_jobs.parse_jobs({"jobs": {"x": {"network": True, "steps": [
[PY, "-m", "scripts.scraper.mame_hash_scraper"]]}}})["x"]
[PY, "-m", "scripts.scraper.arcade.mame_hash_scraper"]]}}})["x"]
with unittest.mock.patch.object(unattended_jobs, "token_env", return_value={"GITHUB_TOKEN": "t1"}), \
unittest.mock.patch.dict(os.environ, {"GITHUB_TOKEN": "t1"}):
self.assertNotIn("GITHUB_TOKEN", unattended_jobs.job_env(job, job.steps[0]))
+6 -5
View File
@@ -73,7 +73,8 @@ from model.romfolders import load_sources, sources_dir
from model.safeparse import yaml_load
from model.targets import platform_overrides
from profiling.reports import ProfileReport, SkipKind, report_to_dict
from scripts.scraper import dat_fetch, game_dat_importer
from scripts.scraper.arcade import dat_fetch
from scripts.scraper.dats import game_dat_importer
from tests.sources import SCRIPTS
REPO_ROOT = Path(__file__).resolve().parents[1]
@@ -969,19 +970,19 @@ class TheBuildbotIndexIsRead(unittest.TestCase):
def test_new_and_dropped_assets_are_stale(self):
from unittest import mock
from scraper import buildbot_system
from freshness import buildbot
report = {"entries": [
{"zip": "New.zip", "status": "NEW", "key": None},
{"zip": "Old.zip", "status": "OK", "key": "old"},
]}
with mock.patch.object(buildbot_system, "check", lambda registry: report):
with mock.patch.object(buildbot, "check", lambda registry: report):
finding = _check_buildbot_system(REPO_ROOT / "platforms")
self.assertEqual(finding.status, STALE)
self.assertIn("new New.zip", finding.detail)
with mock.patch.object(buildbot_system, "check", lambda registry: {"error": "x", "entries": []}):
with mock.patch.object(buildbot, "check", lambda registry: {"error": "x", "entries": []}):
self.assertEqual(_check_buildbot_system(REPO_ROOT / "platforms").status, UNKNOWN)
self.assertEqual([e["zip"] for e in buildbot_system.pending(report)], ["New.zip"])
self.assertEqual([e["zip"] for e in buildbot.pending(report)], ["New.zip"])
+3 -3
View File
@@ -465,12 +465,12 @@ class ArchitectureStatesTheArbitration(unittest.TestCase):
self.assertNotIn("the profile takes precedence for pack generation", page)
section = page[page.index("### When both layers claim one destination"):]
section = section[:section.index("\n## ")]
self.assertIn("`slots.arbitrate()`", section)
self.assertIn("`packs.slots.arbitrate()`", section)
# The pack, the manifest and verify decide through slot_choices, and
# a test in test_slots forbids them to call arbitrate: the page names
# the function they read, not only the one the report prints.
self.assertIn("`slots.slot_choices()`", section)
self.assertIn("`slots.pack_overrides()`", section)
self.assertIn("`packs.slots.slot_choices()`", section)
self.assertIn("`packs.slots.pack_overrides()`", section)
self.assertNotIn("both decide through `slots.arbitrate()`", section)
source = inspect.getsource(slots.arbitrate)
# The three outcomes the section describes.
+1 -1
View File
@@ -205,7 +205,7 @@ class TheCatalogRowsStateFacts(unittest.TestCase):
self.assertEqual(len(rows), 2)
for word in ("stale", "blocks"):
self.assertNotIn(word, " ".join(rows))
scraper = (ROOT / "scripts" / "scraper" / "redump_dat_scraper.py").read_text(encoding="utf-8")
scraper = (ROOT / "scripts" / "scraper" / "dats" / "redump_dat_scraper.py").read_text(encoding="utf-8")
self.assertIn("/bios/<CODE>", scraper)
self.assertIn("`/bios/<CODE>`", rows[0])
+4 -4
View File
@@ -23,7 +23,7 @@ class TestE2EHashScrapers(E2EFixture):
# ---------------------------------------------------------------
def test_mame_parser_finds_bios_root_sets(self):
from scripts.scraper.mame_parser import find_bios_root_sets, parse_rom_block
from scripts.scraper.arcade.mame_parser import find_bios_root_sets, parse_rom_block
source = """
ROM_START( neogeo )
@@ -45,7 +45,7 @@ GAME( 1980, pacman, 0, pacman, pacman, pacman_state, empty_init, ROT90, "Namco",
self.assertEqual(roms[0]["crc32"], "9036d879")
def test_fbneo_parser_finds_bios_sets(self):
from scripts.scraper.fbneo_parser import find_bios_sets, parse_rom_info
from scripts.scraper.arcade.fbneo_parser import find_bios_sets, parse_rom_info
source = """
static struct BurnRomInfo neogeoRomDesc[] = {
@@ -69,7 +69,7 @@ struct BurnDriver BurnDrvneogeo = {
self.assertEqual(roms[0]["crc32"], "9036d879")
def test_mame_merge_preserves_manual_fields(self):
from scripts.scraper._hash_merge import merge_mame_profile
from scripts.scraper.arcade._hash_merge import merge_mame_profile
profile = {
"emulator": "Test",
@@ -119,7 +119,7 @@ struct BurnDriver BurnDrvneogeo = {
self.assertEqual(result["core_version"], "0.286")
def test_fbneo_merge_updates_individual_roms(self):
from scripts.scraper._hash_merge import merge_fbneo_profile
from scripts.scraper.arcade._hash_merge import merge_fbneo_profile
profile = {
"emulator": "FBNeo",
+1 -1
View File
@@ -8,7 +8,7 @@ import tempfile
import unittest
from pathlib import Path
from scripts.scraper.fbneo_parser import (
from scripts.scraper.arcade.fbneo_parser import (
find_bios_sets,
parse_fbneo_source_tree,
parse_rom_info,
+4 -4
View File
@@ -12,7 +12,7 @@ import unittest
from pathlib import Path
from model.region import REGIONS
from scripts.scraper import game_dat_importer as importer
from scripts.scraper.dats import game_dat_importer as importer
ROOT = Path(__file__).resolve().parent.parent
FIXTURES = ROOT / "tests" / "fixtures" / "game_dats"
@@ -25,7 +25,7 @@ except ImportError: # pragma: no cover - CI installs it
def run_import(source: str, output: Path, *extra: str) -> subprocess.CompletedProcess:
return subprocess.run(
[sys.executable, "-m", "scripts.scraper.game_dat_importer", "--source", source,
[sys.executable, "-m", "scripts.scraper.dats.game_dat_importer", "--source", source,
"--pack", str(FIXTURES), "--output-dir", str(output), *extra],
cwd=ROOT, capture_output=True, text=True, check=False,
)
@@ -120,7 +120,7 @@ class FixtureImport(unittest.TestCase):
def test_offline_without_cache_names_the_remedy(self) -> None:
result = subprocess.run(
[sys.executable, "-m", "scripts.scraper.game_dat_importer", "--source", "redump",
[sys.executable, "-m", "scripts.scraper.dats.game_dat_importer", "--source", "redump",
"--cache-dir", str(self.out / "empty"), "--output-dir", str(self.out)],
cwd=ROOT, capture_output=True, text=True, check=False,
)
@@ -132,7 +132,7 @@ class OneLogiqxReader(unittest.TestCase):
"""The catalog importer read <game> only and kept nameless ROMs."""
def test_machine_entries_and_serials(self) -> None:
from scripts.scraper.logiqx_parser import parse_logiqx_games
from scripts.scraper.dats.logiqx_parser import parse_logiqx_games
name, version, games = parse_logiqx_games(
b'<datafile><header><name>D</name><version>1</version></header>'
+14 -12
View File
@@ -12,14 +12,14 @@ from typing import Any
import yaml
from scripts.scraper._hash_merge import (
from scripts.scraper.arcade._hash_merge import (
_build_source_ref,
compute_diff,
load_profile,
merge_fbneo_profile,
merge_mame_profile,
)
from scripts.scraper._hash_write import write_fbneo_profile, write_mame_profile
from scripts.scraper.arcade._hash_write import write_fbneo_profile, write_mame_profile
def _refresh_mame(path: Path, hashes: dict) -> None:
@@ -255,7 +255,7 @@ class TestMameMerge(unittest.TestCase):
The manager set loads "01", but written unquoted it re-parses as the
integer 1 and the profile stops naming the file the driver opens.
"""
from scripts.scraper._hash_write import _append_new_entries, format_contents
from scripts.scraper.arcade._hash_write import _append_new_entries, format_contents
contents = [
{"name": "01", "description": "ROM bank 0-1", "size": 8192,
@@ -414,9 +414,9 @@ class TheScraperClonesTheReleaseItLabels(unittest.TestCase):
def test_clone_and_version_come_from_one_tag(self):
from unittest import mock
from scripts.scraper import mame_hash_scraper as scraper
from scripts.scraper.arcade import mame_hash_scraper as scraper
from scripts.scraper import sparse_clone
from scripts.scraper.arcade import sparse_clone
calls: list[list[str]] = []
@@ -443,7 +443,7 @@ class AReleaseProfileDescribesItsOwnRelease(unittest.TestCase):
gives a set."""
def test_sets_pins_and_systems(self):
from scripts.scraper.mame_hash_scraper import release_profile
from scripts.scraper.arcade.mame_hash_scraper import release_profile
bios_sets = {
"neogeo": {"source_file": "src/mame/neogeo/neogeo.cpp", "source_line": 10,
@@ -478,7 +478,7 @@ class AReleaseProfileDescribesItsOwnRelease(unittest.TestCase):
def test_a_set_the_release_runs_without_is_not_required(self):
"""recel is undumped at 0.258: the current profile's true does not apply."""
from scripts.scraper.mame_hash_scraper import release_profile
from scripts.scraper.arcade.mame_hash_scraper import release_profile
bios_sets = {
"recel": {"source_file": "src/mame/pinball/recel.cpp", "source_line": 505,
@@ -501,7 +501,7 @@ class AReleaseProfileDescribesItsOwnRelease(unittest.TestCase):
self.assertTrue(files["neogeo.zip"]["required"])
def test_a_release_profile_is_left_out_of_the_current_refresh(self):
from scripts.scraper.mame_hash_scraper import _find_mame_profiles
from scripts.scraper.arcade.mame_hash_scraper import _find_mame_profiles
names = {path.name for path in _find_mame_profiles()}
self.assertIn("mame.yml", names)
@@ -509,7 +509,7 @@ class AReleaseProfileDescribesItsOwnRelease(unittest.TestCase):
def test_a_pinned_build_of_the_mame_tree_is_left_out(self):
"""pSxMAME builds mamedev/mame at 0.133: refreshed, it would carry 0.289 refs."""
from scripts.scraper.mame_hash_scraper import _find_mame_profiles
from scripts.scraper.arcade.mame_hash_scraper import _find_mame_profiles
self.assertNotIn("psxmame.yml", {path.name for path in _find_mame_profiles()})
@@ -761,7 +761,7 @@ class AnUnreadableCloneStopsTheScrape(unittest.TestCase):
import subprocess
from unittest import mock
from scripts.scraper import sparse_clone
from scripts.scraper.arcade import sparse_clone
dest = Path(tempfile.gettempdir()) / "retrobios-no-clone"
failing = subprocess.CalledProcessError(128, ["git", "rev-parse", "HEAD"])
@@ -840,7 +840,8 @@ class OneCloneDirectoryPerRun(unittest.TestCase):
def test_the_clone_directory_names_the_process(self):
import os
from scripts.scraper import fbneo_hash_scraper, mame_hash_scraper
from scripts.scraper.arcade import fbneo_hash_scraper
from scripts.scraper.arcade import mame_hash_scraper
for clone in (mame_hash_scraper._CLONE_DIR, fbneo_hash_scraper.CLONE_DIR):
with self.subTest(clone=clone.name):
@@ -854,7 +855,8 @@ class ABrokenProfileStopsTheRefresh(unittest.TestCase):
def test_both_scrapers_name_it(self):
from unittest import mock
from scripts.scraper import fbneo_hash_scraper, mame_hash_scraper
from scripts.scraper.arcade import fbneo_hash_scraper
from scripts.scraper.arcade import mame_hash_scraper
with tempfile.TemporaryDirectory() as directory:
Path(directory, "fbneo.yml").write_text("files: [\n - name: a\n")
+2 -2
View File
@@ -29,8 +29,8 @@ from resolve.launchers import handed_directories
from resolve.launcherplaces import launcher_places
from profiling.reportinputs import check_build_refs
from profiling.repos import shipped_build_holders
from scraper.retrobat_launchers import _choices_apart
from scraper.shell_launchers import LauncherPatternMissing, Script, config_placement
from scraper.launchers.retrobat import _choices_apart
from scraper.launchers.shell import LauncherPatternMissing, Script, config_placement
from resolve.launcherrefs import config_ref, is_feature_ref
REPO_ROOT = Path(__file__).resolve().parents[1]
+2 -3
View File
@@ -398,10 +398,9 @@ class LauncherLayerTest(unittest.TestCase):
def test_every_extractor_spelling_of_the_bios_folder_is_known(self) -> None:
from resolve.launcherplaces import BIOS_ROOT_TOKENS
from scraper import emudeck_launchers, retrodeck_launchers, retropie_reader
from scraper.launchers import emudeck, retrodeck, retropie_reader
for token in (emudeck_launchers.BIOS, retrodeck_launchers.BIOS,
retropie_reader.BIOSDIR):
for token in (emudeck.BIOS, retrodeck.BIOS, retropie_reader.BIOSDIR):
self.assertIn(token, BIOS_ROOT_TOKENS)
def test_no_place_is_filled_twice(self) -> None:
+6 -6
View File
@@ -17,11 +17,11 @@ import unittest
from pathlib import Path
from resolve.launchers import handed_directories, standalone_bindings
from scraper import retrobat_generators
from scraper.retrobat_arguments import portable_users
from scraper.csharp_source import Source
from scraper.batocera_configgen import GENERATORS, IMPORTER, PATHS_MODULE, Configgen
from scraper.batocera_launchers import LauncherShapeError, patched_paths, working_directories
from scraper.launchers import retrobat_generators
from scraper.launchers.retrobat_arguments import portable_users
from scraper.launchers.csharp_source import Source
from scraper.launchers.batocera_configgen import GENERATORS, IMPORTER, PATHS_MODULE, Configgen
from scraper.launchers.batocera import LauncherShapeError, patched_paths, working_directories
REPO_ROOT = Path(__file__).resolve().parent.parent
@@ -298,7 +298,7 @@ class OnlyWhatABoardBuildsIsRun(unittest.TestCase):
self.assertIn("suyu", bs.configgen_cores(self.DEFAULTS, self.ES, set())[0])
def test_the_extractor_reports_programs_run_from_its_own_bios_root(self):
from scraper.batocera_launchers import Launcher, extraction
from scraper.launchers.batocera import Launcher, extraction
# A fork whose batoceraPaths puts the BIOS folder elsewhere: the
# report follows the root its code gives, not Batocera's.
+2 -2
View File
@@ -17,8 +17,8 @@ from pathlib import Path
import yaml
from model.launcherrecords import record_emulators
from scraper import amberelec_launchers as al
from scraper.configgen_launchers import LauncherShapeError
from scraper.launchers import amberelec as al
from scraper.launchers.configgen import LauncherShapeError
REPO_ROOT = Path(__file__).resolve().parent.parent
+13 -7
View File
@@ -18,16 +18,22 @@ from pathlib import Path
import yaml
from model.launcherrecords import record_emulators
from scraper.batocera_configgen import CONFIGGEN, GENERATORS, IMPORTER, PATHS_MODULE, Configgen
from scraper.batocera_launchers import (
from scraper.launchers.batocera_configgen import (
CONFIGGEN,
GENERATORS,
IMPORTER,
PATHS_MODULE,
Configgen,
)
from scraper.launchers.batocera import (
Launcher,
LauncherShapeError,
config_directories,
extract_launchers,
)
from scraper.batocera_searches import duckstation, hatari
from scraper.batocera_config_writes import lexaloffle
from scraper.retropie_scripts import Launcher as PackageLauncher
from scraper.launchers.batocera_searches import duckstation, hatari
from scraper.launchers.batocera_config_writes import lexaloffle
from scraper.launchers.retropie_scripts import Launcher as PackageLauncher
from tests.launcherssupport import placed
REPO_ROOT = Path(__file__).resolve().parent.parent
@@ -532,7 +538,7 @@ class MameSearchPaths(unittest.TestCase):
"""mameGenerator.py:129-142 at batocera-43.1: `-rompath` and `-samplepath`."""
def test_the_command_line_search_paths_are_recorded(self):
from scraper.batocera_launchers import search_paths
from scraper.launchers.batocera import search_paths
cg = configgen({
MAME: placed({1: MAME_HEAD, 129: MAME_COMMAND, 142: MAME_SAMPLES, 378: MAME_BOOT}),
@@ -620,7 +626,7 @@ class PlatformRecords(unittest.TestCase):
def test_every_reference_is_in_configgen(self):
# Or in a patch Batocera applies to an emulator's own path code.
from scraper.batocera_launchers import PATH_PATCHES
from scraper.launchers.batocera import PATH_PATCHES
for record in self.config["launchers"]:
self.assertTrue(
+2 -2
View File
@@ -16,9 +16,9 @@ from pathlib import Path
import yaml
from scraper import emudeck_launchers as el
from scraper.launchers import emudeck as el
from model.sourcerevision import required_revision
from scraper.shell_launchers import LauncherPatternMissing, RepoTree, words
from scraper.launchers.shell import LauncherPatternMissing, RepoTree, words
REPO_ROOT = Path(__file__).resolve().parent.parent
+4 -4
View File
@@ -17,11 +17,11 @@ from pathlib import Path
import yaml
from scraper import emuelec_launchers as el
from scraper import emuelec_runs
from scraper.emuelec_runs import SX05RE, BIN, Runs, LIBRETRO, EMULATORS
from scraper.launchers import emuelec as el
from scraper.launchers import emuelec_runs
from scraper.launchers.emuelec_runs import SX05RE, BIN, Runs, LIBRETRO, EMULATORS
from model.sourcerevision import required_revision
from scraper.shell_launchers import LauncherPatternMissing, RepoTree
from scraper.launchers.shell import LauncherPatternMissing, RepoTree
REPO_ROOT = Path(__file__).resolve().parent.parent
+5 -5
View File
@@ -17,11 +17,11 @@ from pathlib import Path
import yaml
from model.launcherrecords import record_emulators
from scraper import knulli_launchers as kl
from scraper.configgen_sites import bios_sites, GenericSites
from scraper.batocera_searches import hatari
from scraper.batocera_config_writes import melonds
from scraper.configgen_launchers import LauncherShapeError
from scraper.launchers import knulli as kl
from scraper.launchers.configgen_sites import bios_sites, GenericSites
from scraper.launchers.batocera_searches import hatari
from scraper.launchers.batocera_config_writes import melonds
from scraper.launchers.configgen import LauncherShapeError
REPO_ROOT = Path(__file__).resolve().parent.parent
+4 -4
View File
@@ -18,7 +18,7 @@ import yaml
from model.launcherrecords import emulator_names, record_emulators
from scraper import recalbox_scraper
from scraper.recalbox_configgen import (
from scraper.launchers.recalbox_configgen import (
ALL_CORES,
AMIBERRY_CONFIG,
AMIBERRY_GLOBAL,
@@ -36,7 +36,7 @@ from scraper.recalbox_configgen import (
XEMU,
XROAR,
)
from scraper.recalbox_launchers import (
from scraper.launchers.recalbox import (
SOURCE_FILES,
Launcher,
LauncherShapeError,
@@ -46,8 +46,8 @@ from scraper.recalbox_launchers import (
extract_launchers,
system_directories,
)
from scraper.recalbox_emulators import amiberry, dolphin, mupen64plus, pcsx2, xemu, xroar
from scraper.recalbox_cascades import gsplus, hatari, hatari_libretro
from scraper.launchers.recalbox_emulators import amiberry, dolphin, mupen64plus, pcsx2, xemu, xroar
from scraper.launchers.recalbox_cascades import gsplus, hatari, hatari_libretro
from tests.launchersrecalboxsupport import configgen, files, ref
+8 -11
View File
@@ -15,17 +15,14 @@ import tempfile
import unittest
from pathlib import Path
from scraper import retrobat_launchers as rl
from scraper import retrobat_generators
from scraper.retrobat_computers import hatari, openmsx, amiberry
from scraper.retrobat_config_files import (
ares,
mesen,
)
from scraper.retrobat_generators import GENERATORS, GUARDED_WRITES, guarded_writes_in
from scraper.retrobat_playstation import duckstation, psx_cascades
from scraper.retrobat_render import _option_path_in
from scraper.csharp_source import LauncherPatternMissing, Source, render_concat
from scraper.launchers import retrobat as rl
from scraper.launchers import retrobat_generators
from scraper.launchers.retrobat_computers import hatari, openmsx, amiberry
from scraper.launchers.retrobat_config_files import ares, mesen
from scraper.launchers.retrobat_generators import GENERATORS, GUARDED_WRITES, guarded_writes_in
from scraper.launchers.retrobat_playstation import duckstation, psx_cascades
from scraper.launchers.retrobat_render import _option_path_in
from scraper.launchers.csharp_source import LauncherPatternMissing, Source, render_concat
from model.sourcerevision import required_revision
from tests.launcherssupport import _sources
+8 -8
View File
@@ -11,9 +11,9 @@ import tests
import unittest
from scraper import retrobat_generators
from scraper.retrobat_arguments import pico8, xroar, mame
from scraper.retrobat_config_files import (
from scraper.launchers import retrobat_generators
from scraper.launchers.retrobat_arguments import pico8, xroar, mame
from scraper.launchers.retrobat_config_files import (
bizhawk_gb,
dolphin,
blastem,
@@ -21,11 +21,11 @@ from scraper.retrobat_config_files import (
melonds_dsi,
desmume,
)
from scraper.retrobat_config_folders import eka2l1, tsugaru, dosbox_copies
from scraper.retrobat_generators import GENERATORS
from scraper.retrobat_render import render
from scraper.retrobat_xbox import CXBX_DATA_FOLDER, cxbx, xemu_saves
from scraper.csharp_source import LauncherPatternMissing, Source
from scraper.launchers.retrobat_config_folders import eka2l1, tsugaru, dosbox_copies
from scraper.launchers.retrobat_generators import GENERATORS
from scraper.launchers.retrobat_render import render
from scraper.launchers.retrobat_xbox import CXBX_DATA_FOLDER, cxbx, xemu_saves
from scraper.launchers.csharp_source import LauncherPatternMissing, Source
from tests.launcherssupport import _sources
+1 -1
View File
@@ -16,7 +16,7 @@ from pathlib import Path
import yaml
from scraper import retrodeck_launchers as rd
from scraper.launchers import retrodeck as rd
REPO_ROOT = Path(__file__).resolve().parent.parent
+4 -4
View File
@@ -18,9 +18,9 @@ from pathlib import Path
import yaml
from scraper import batocera_launchers
from scraper import retropie_launchers as rl
from scraper.retropie_scripts import Launcher, Scripts, LauncherPatternMissing
from scraper.launchers import batocera as batocera_launchers
from scraper.launchers import retropie as rl
from scraper.launchers.retropie_scripts import Launcher, Scripts, LauncherPatternMissing
REPO_ROOT = Path(__file__).resolve().parent.parent
@@ -301,7 +301,7 @@ class AdvanceMameSearchList(unittest.TestCase):
)
def test_mame_does_not_read_a_colon_as_a_separator(self):
from scraper.retropie_reader import LIST_SEPARATORS
from scraper.launchers.retropie_reader import LIST_SEPARATORS
self.assertNotIn("mame", LIST_SEPARATORS)
self.assertEqual(
+4 -4
View File
@@ -17,11 +17,11 @@ from pathlib import Path
import yaml
from scraper import rocknix_launchers as rl
from scraper import rocknix_configs
from scraper.rocknix_configs import ROCKNIX, DEVICES, STANDALONE
from scraper.launchers import rocknix as rl
from scraper.launchers import rocknix_configs
from scraper.launchers.rocknix_configs import ROCKNIX, DEVICES, STANDALONE
from model.sourcerevision import required_revision
from scraper.shell_launchers import LauncherPatternMissing, RepoTree
from scraper.launchers.shell import LauncherPatternMissing, RepoTree
REPO_ROOT = Path(__file__).resolve().parent.parent
+2 -2
View File
@@ -29,8 +29,8 @@ class LinesOfOffsets(unittest.TestCase):
class ParsersReportLines(unittest.TestCase):
def test_mame_and_fbneo_sets_carry_their_line(self):
from scripts.scraper.fbneo_parser import find_bios_sets
from scripts.scraper.mame_parser import find_bios_root_sets
from scripts.scraper.arcade.fbneo_parser import find_bios_sets
from scripts.scraper.arcade.mame_parser import find_bios_root_sets
mame = "\n\nGAME( 1990, neogeo, 0, ng, ng, ng_state, init, ROT0, \"SNK\", \"Neo\", MACHINE_IS_BIOS_ROOT )\n"
self.assertEqual(find_bios_root_sets(mame, "neogeo.cpp")["neogeo"]["source_line"], 3)
+2 -2
View File
@@ -10,8 +10,8 @@ import unittest
import zipfile
from pathlib import Path
from scripts.scraper import listxml
from scripts.scraper.listxml import attrs, iter_elements, open_listxml, rom_members
from scripts.scraper.dats import listxml
from scripts.scraper.dats.listxml import attrs, iter_elements, open_listxml, rom_members
DOCUMENT = b"""<?xml version="1.0"?>
<mame build="0.289 (mame0289)">
+8 -8
View File
@@ -17,11 +17,11 @@ import unittest
from pathlib import Path
from scripts.model.safeparse import yaml_load
from scripts.scraper._hash_write import DEVICE_SECTION, SOFTLIST_SECTION, write_mame_profile
from scripts.scraper._hash_merge import load_profile, mame_ref_role, merge_mame_profile
from scripts.scraper._mame_sections import merge_mame_devices, merge_mame_support
from scripts.scraper.listxml import open_listxml
from scripts.scraper.mame_devices import (
from scripts.scraper.arcade._hash_write import DEVICE_SECTION, SOFTLIST_SECTION, write_mame_profile
from scripts.scraper.arcade._hash_merge import load_profile, mame_ref_role, merge_mame_profile
from scripts.scraper.arcade._mame_sections import merge_mame_devices, merge_mame_support
from scripts.scraper.dats.listxml import open_listxml
from scripts.scraper.arcade.mame_devices import (
ABSENT,
AMBIGUOUS,
NO_FILE,
@@ -1001,7 +1001,7 @@ class TheRepositoryProfile(unittest.TestCase):
class Cli(unittest.TestCase):
def test_devices_needs_a_listxml(self):
from scripts.scraper.mame_hash_scraper import main
from scripts.scraper.arcade.mame_hash_scraper import main
import sys
from unittest import mock
@@ -1019,7 +1019,7 @@ class TheDevicesFollowTheRelease(unittest.TestCase):
import argparse
from unittest import mock
from scripts.scraper import mame_hash_scraper as scraper
from scripts.scraper.arcade import mame_hash_scraper as scraper
with tempfile.TemporaryDirectory() as directory:
profile = Path(directory) / "mame.yml"
@@ -1058,7 +1058,7 @@ class TheDevicesFollowTheRelease(unittest.TestCase):
import argparse
from unittest import mock
from scripts.scraper import mame_hash_scraper as scraper
from scripts.scraper.arcade import mame_hash_scraper as scraper
with tempfile.TemporaryDirectory() as directory:
profile = Path(directory) / "mame.yml"
+3 -3
View File
@@ -8,7 +8,7 @@ import os
import tempfile
import unittest
from scripts.scraper.mame_parser import (
from scripts.scraper.arcade.mame_parser import (
find_bios_root_sets,
parse_mame_source_tree,
parse_rom_block,
@@ -407,7 +407,7 @@ class TestCSourceLexer(unittest.TestCase):
"""One reader of C comments and macro calls for every driver scraper."""
def test_a_char_literal_quote_opens_no_string(self) -> None:
from scripts.scraper.clex import blank_comments
from scripts.scraper.arcade.clex import blank_comments
text = "c = '\"'; /* ROM_START( fake ) */\nx"
self.assertNotIn("ROM_START", blank_comments(text))
@@ -415,7 +415,7 @@ class TestCSourceLexer(unittest.TestCase):
self.assertEqual(blank_comments("a/*x\ny*/b", keep_lines=False), "a b")
def test_an_escaped_quote_does_not_end_the_call(self) -> None:
from scripts.scraper.clex import call_span
from scripts.scraper.arcade.clex import call_span
text = 'GAME(1990, foo, "a\\"b)", 0) tail'
self.assertEqual(call_span(text, 5), (["1990", "foo", '"a\\"b)"', "0"], 27))
+3 -3
View File
@@ -18,9 +18,9 @@ from scripts.model.dumpcatalog import (
)
from scripts.sitegen.provenance import generate_provenance_page, wanted_dumps
from scripts.acquire.provenance import build_report
from scripts.scraper.dat_pack_importer import _bios_entries, import_pack
from scripts.scraper.logiqx_parser import parse_logiqx, validate_logiqx_format
from scripts.scraper.redump_dat_scraper import discover_bios_datfiles, parse_redump_dat
from scripts.scraper.dats.dat_pack_importer import _bios_entries, import_pack
from scripts.scraper.dats.logiqx_parser import parse_logiqx, validate_logiqx_format
from scripts.scraper.dats.redump_dat_scraper import discover_bios_datfiles, parse_redump_dat
LOGIQX_GAME_FIXTURE = """<?xml version="1.0"?>
<datafile>
+4 -4
View File
@@ -23,7 +23,7 @@ import zipfile
from pathlib import Path
from unittest import mock
from scraper import buildbot_system
from freshness import buildbot
from packs import datadirs
REPO_ROOT = Path(__file__).resolve().parent.parent
@@ -187,7 +187,7 @@ class RefreshFailuresAreFailures(unittest.TestCase):
def test_a_failed_refresh_is_returned_and_exits_nonzero(self):
report = {"entries": [{"status": "UPDATED", "key": "dolphin-sys"},
{"status": "OK", "key": "ppsspp-assets"}]}
self.assertEqual(buildbot_system.updated(report), ["dolphin-sys"])
self.assertEqual(buildbot.updated(report), ["dolphin-sys"])
registry = {"dolphin-sys": {"local_cache": "data/dolphin-sys"}}
with mock.patch.object(datadirs, "refresh_entry", return_value=None):
self.assertEqual(datadirs.refresh_keys(registry, ["dolphin-sys"]), ["dolphin-sys"])
@@ -217,8 +217,8 @@ class RefreshFailuresAreFailures(unittest.TestCase):
seen.append((key, entry))
return True
with mock.patch.object(buildbot_system, "fetch_index", return_value={"Else.zip"}), \
mock.patch.object(buildbot_system, "get_remote_etag", return_value='"new"'), \
with mock.patch.object(buildbot, "fetch_index", return_value={"Else.zip"}), \
mock.patch.object(buildbot, "get_remote_etag", return_value='"new"'), \
mock.patch.object(datadirs, "refresh_entry", side_effect=refresh), \
mock.patch.object(sys, "argv", ["check_buildbot_system.py", "--update",
"--registry", str(registry)]), \
+3 -3
View File
@@ -134,7 +134,7 @@ class Planning(unittest.TestCase):
"batocera": "-m scripts.scraper.targets.batocera_targets_scraper"
" -o platforms/targets/batocera.yml",
"dolphin-sys": "scripts/refresh_data_dirs.py --key dolphin-sys --force",
"fbneo recipes": "-m scripts.scraper.romset_dat_importer"
"fbneo recipes": "-m scripts.scraper.arcade.romset_dat_importer"
" --source fbneo --fetch",
},
)
@@ -146,9 +146,9 @@ class Planning(unittest.TestCase):
self.assertEqual(
{j.subject: " ".join(j.command[1:]) for j in jobs},
{
"no-intro games": "-m scripts.scraper.game_dat_importer --source no-intro"
"no-intro games": "-m scripts.scraper.dats.game_dat_importer --source no-intro"
" --fetch --refresh --floor",
"redump games": "-m scripts.scraper.game_dat_importer --source redump"
"redump games": "-m scripts.scraper.dats.game_dat_importer --source redump"
" --fetch --refresh --floor",
},
)
+14 -13
View File
@@ -24,7 +24,7 @@ from romrecipes.identify import (
reconstruct,
write_reconstructions,
)
from scripts.scraper.romset_dat_importer import (
from scripts.scraper.arcade.romset_dat_importer import (
catalog_targets,
compact_entries,
holds_target,
@@ -32,7 +32,7 @@ from scripts.scraper.romset_dat_importer import (
merge_snapshot,
recipe_entries,
)
from scripts.scraper.logiqx_parser import parse_logiqx
from scripts.scraper.dats.logiqx_parser import parse_logiqx
from core.hashing import git_blob_sha
from core.torrentzip import build_torrentzip, is_torrentzip
@@ -421,7 +421,7 @@ class ListXmlRecipes(unittest.TestCase):
def test_a_machine_larger_than_the_window_is_kept(self):
"""Each machine here spans several reads: the window grows until the
element closes instead of cutting its start tag away."""
from scripts.scraper import listxml
from scripts.scraper.dats import listxml
expected = listxml_entries(self._opener(self._document()), "MAME 0.289", None)
saved = listxml.LISTXML_CHUNK
@@ -455,7 +455,7 @@ class ListXmlRecipes(unittest.TestCase):
def test_a_set_kept_under_another_name_is_matched_by_members(self):
"""aga.zip holds exactly MAME's isa_aga: the entry carries the
collection's name and keeps the upstream one in ``set``."""
from scripts.scraper.romset_dat_importer import member_list
from scripts.scraper.arcade.romset_dat_importer import member_list
child = [
{"name": "own.rom", "crc32": loopback.crc(ROM_B)},
@@ -474,7 +474,7 @@ class ListXmlRecipes(unittest.TestCase):
)
def test_matching_by_members_keeps_the_named_sets(self):
from scripts.scraper.romset_dat_importer import member_list
from scripts.scraper.arcade.romset_dat_importer import member_list
entries = listxml_entries(
self._opener(self._document()), "MAME 0.289", {"parentset.zip"},
@@ -484,7 +484,7 @@ class ListXmlRecipes(unittest.TestCase):
def test_one_entry_per_archive_its_own_set_first(self):
"""Thirty keyboard sets share one ROM: the set named like the archive wins."""
from scripts.scraper.romset_dat_importer import one_set_per_archive
from scripts.scraper.arcade.romset_dat_importer import one_set_per_archive
members = [{"name": "kbd.rom", "crc32": "12345678"}]
entries = one_set_per_archive([
@@ -495,7 +495,7 @@ class ListXmlRecipes(unittest.TestCase):
self.assertEqual([entry["set"] for entry in entries], ["a500kbd"])
def test_a_logiqx_set_is_matched_by_members_too(self):
from scripts.scraper.romset_dat_importer import member_list
from scripts.scraper.arcade.romset_dat_importer import member_list
members = [
{"name": "01", "crc32": loopback.crc(ROM_A)},
@@ -512,7 +512,7 @@ class ListXmlRecipes(unittest.TestCase):
def test_the_collection_names_and_member_lists(self):
"""A .variants/ copy stands for the name its tag is cut from."""
from scripts.scraper.romset_dat_importer import collection_archives, member_list
from scripts.scraper.arcade.romset_dat_importer import collection_archives, member_list
with tempfile.TemporaryDirectory() as temp:
root = Path(temp)
@@ -539,7 +539,8 @@ class ListXmlRecipes(unittest.TestCase):
from argparse import Namespace
from model.database import DatabaseUnreadable
from scripts.scraper import arcade_parent_importer, romset_dat_importer
from scripts.scraper.arcade import arcade_parent_importer
from scripts.scraper.arcade import romset_dat_importer
args = Namespace(all=False, db=str(TMP_ROOT / "nosuch.json"))
with self.assertRaises(DatabaseUnreadable):
@@ -864,7 +865,7 @@ class AnOversizedDatIsNamed(unittest.TestCase):
import io
import zipfile
from scripts.scraper.listxml import iter_dat_documents
from scripts.scraper.dats.listxml import iter_dat_documents
with tempfile.TemporaryDirectory() as directory:
pack = Path(directory) / "pack.zip"
@@ -880,7 +881,7 @@ class AnOversizedDatIsNamed(unittest.TestCase):
folder, and dat_pack_importer refused a lone DAT file."""
import zipfile
from scripts.scraper.listxml import iter_dat_documents
from scripts.scraper.dats.listxml import iter_dat_documents
with tempfile.TemporaryDirectory(dir=TMP_ROOT) as directory:
root = Path(directory)
@@ -912,8 +913,8 @@ class FbneoFetchReadsOneRevision(unittest.TestCase):
CDN caches, and --fetch <revision> read the tip whatever was named."""
def setUp(self):
from scripts.scraper import dat_fetch
from scripts.scraper import romset_dat_importer as importer
from scripts.scraper.arcade import dat_fetch
from scripts.scraper.arcade import romset_dat_importer as importer
self.dat_fetch = dat_fetch
self.importer = importer
+3 -3
View File
@@ -1229,7 +1229,7 @@ class HashScraperRefusesAnEmptyRead(unittest.TestCase):
"commit": "abc", "bios_sets": sets}
def test_mame_raises_and_writes_no_cache(self):
from scraper import mame_hash_scraper as m
from scraper.arcade import mame_hash_scraper as m
with tempfile.TemporaryDirectory() as tmp:
cache = Path(tmp) / "mame-hashes.json"
@@ -1242,7 +1242,7 @@ class HashScraperRefusesAnEmptyRead(unittest.TestCase):
def test_fbneo_raises_and_writes_no_cache(self):
from scraper import fbneo_hash_scraper as f
from scraper.arcade import fbneo_hash_scraper as f
with tempfile.TemporaryDirectory() as tmp:
cache = Path(tmp) / "fbneo-hashes.json"
@@ -1254,7 +1254,7 @@ class HashScraperRefusesAnEmptyRead(unittest.TestCase):
self.assertFalse(cache.exists())
def test_an_empty_or_unreadable_cache_is_not_served(self):
from scraper.sparse_clone import fresh_cache
from scraper.arcade.sparse_clone import fresh_cache
with tempfile.TemporaryDirectory() as tmp:
cache = Path(tmp) / "hashes.json"
+14 -9
View File
@@ -492,9 +492,9 @@ class Scrapers(unittest.TestCase):
"""The records each platform's scraper writes for these directories."""
def test_rocknix_patched_data_directory(self) -> None:
from scraper import rocknix_launchers as rl
from scraper.rocknix_configs import STANDALONE
from scraper.shell_launchers import LauncherPatternMissing, RepoTree
from scraper.launchers import rocknix as rl
from scraper.launchers.rocknix_configs import STANDALONE
from scraper.launchers.shell import LauncherPatternMissing, RepoTree
path = f"{STANDALONE}/flycast-sa/patches/000-conf-dir.patch"
patch = textwrap.dedent("""\
@@ -518,9 +518,14 @@ class Scrapers(unittest.TestCase):
rl.patched_directories(RepoTree.from_files({path: patch.replace("return", "x =")}))
def test_batocera_environment_directory(self) -> None:
from scraper.batocera_configgen import GENERATORS, IMPORTER, PATHS_MODULE, Configgen
from scraper.batocera_launchers import environment_directories
from scraper.configgen_launchers import LauncherShapeError
from scraper.launchers.batocera_configgen import (
GENERATORS,
IMPORTER,
PATHS_MODULE,
Configgen,
)
from scraper.launchers.batocera import environment_directories
from scraper.launchers.configgen import LauncherShapeError
paths = "from pathlib import Path\nBIOS = Path('/userdata/bios')\nCONFIGS = Path('/userdata/system/configs')\n"
importer = "_GENERATOR_MAP = {}\n_LEGACY_GENERATOR_MAP = {}\n"
@@ -551,9 +556,9 @@ class Scrapers(unittest.TestCase):
environment_directories(Configgen(tree.__getitem__))
def test_retrobat_bios_path_setting(self) -> None:
from scraper import retrobat_generators
from scraper.retrobat_config_files import value_writes
from scraper.csharp_source import Source
from scraper.launchers import retrobat_generators
from scraper.launchers.retrobat_config_files import value_writes
from scraper.launchers.csharp_source import Source
path = f"{retrobat_generators.GENERATORS}/Flycast.Generator.cs"
text = textwrap.dedent("""\
+2 -2
View File
@@ -844,7 +844,7 @@ class EmuDeckScriptNamesHaveOneRule(unittest.TestCase):
rename added to one copy only made --target filter that core out."""
def test_the_target_scraper_names_scripts_as_the_platform_does(self):
from scripts.scraper.emudeck_launchers import emulator_of_script
from scripts.scraper.launchers.emudeck import emulator_of_script
listing = [
"emuDeckRMG.sh",
@@ -899,7 +899,7 @@ class HashScrapersRefuseAnUnknownVersion(unittest.TestCase):
and cached it for a day, while the pipeline step still read OK."""
def test_mame_raises(self):
from scripts.scraper import mame_hash_scraper
from scripts.scraper.arcade import mame_hash_scraper
with mock.patch("urllib.request.urlopen", _refuse), \
self.assertRaises(RuntimeError):