mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-12-02 06:18:51 -06:00
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:
1 parent
4e01cff854
commit
e1bad01b82
130 files changed
+445
-414
No files matched your search
+2
-2
@@ -53,9 +53,9 @@ jobs:
|
||||
- run: [python, scripts/refresh_stale.py, --findings, tmp/autorun/freshness.json,
|
||||
--only, "data,catalogs"]
|
||||
github_token: true
|
||||
- run: [python, -m, scripts.scraper.mame_hash_scraper]
|
||||
- run: [python, -m, scripts.scraper.arcade.mame_hash_scraper]
|
||||
github_token: true
|
||||
- run: [python, -m, scripts.scraper.fbneo_hash_scraper]
|
||||
- run: [python, -m, scripts.scraper.arcade.fbneo_hash_scraper]
|
||||
github_token: true
|
||||
gate:
|
||||
- [python, scripts/pipeline.py, --offline]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://abdess.github.io/retrobios/api/v1/schemas/arcade-parents.schema.json",
|
||||
"title": "RetroBIOS arcade parent index of one core version",
|
||||
"description": "games/arcade/<profile>.json, written by python -m scripts.scraper.arcade_parent_importer from the DAT or the driver code the profile pins. A game set needs every BIOS set it is listed under (the romof chain read to its end) and, for the MAME family, every device set with ROMs it is listed under.",
|
||||
"description": "games/arcade/<profile>.json, written by python -m scripts.scraper.arcade.arcade_parent_importer from the DAT or the driver code the profile pins. A game set needs every BIOS set it is listed under (the romof chain read to its end) and, for the MAME family, every device set with ROMs it is listed under.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["schema", "profile", "core_version", "source", "bios", "devices", "chd", "missing_parents", "no_bios", "bios_sets", "counts"],
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://abdess.github.io/retrobios/api/v1/schemas/game-catalog.schema.json",
|
||||
"title": "RetroBIOS game catalog of one system",
|
||||
"description": "Games of one No-Intro or Redump DAT, keyed by what identifies a game file (games/catalogs/<source>/<system>.json, written by python -m scripts.scraper.game_dat_importer). A row's region is the market the DAT names, never the value a core computes.",
|
||||
"description": "Games of one No-Intro or Redump DAT, keyed by what identifies a game file (games/catalogs/<source>/<system>.json, written by python -m scripts.scraper.dats.game_dat_importer). A row's region is the market the DAT names, never the value a core computes.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["source", "system", "dat", "version", "fetched_from", "fetched", "archive", "licence", "fields", "regions", "games"],
|
||||
|
||||
@@ -21,13 +21,7 @@ from core.cli import InputMissing
|
||||
from core.paths import DATA_DIRS_FILE
|
||||
from model.registry import data_dir_registry_at
|
||||
from packs.datadirs import refresh_keys
|
||||
from scraper.buildbot_system import (
|
||||
check,
|
||||
pending,
|
||||
print_report,
|
||||
unanswered,
|
||||
updated,
|
||||
)
|
||||
from freshness.buildbot import check, pending, print_report, unanswered, updated
|
||||
|
||||
|
||||
def main() -> None:
|
||||
|
||||
@@ -13,7 +13,7 @@ from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
||||
|
||||
from scraper.dat_parser import parse_dat
|
||||
from scraper.dats.dat_parser import parse_dat
|
||||
|
||||
from .base_exporter import BaseExporter
|
||||
from resolve.nativemodel import NativeFile, NativeSystem, Report
|
||||
|
||||
@@ -9,7 +9,7 @@ import urllib.parse
|
||||
from core.forgehttp import remote_etag as get_remote_etag
|
||||
from core.paths import DATA_DIRS_FILE
|
||||
from model.registry import data_dir_registry_at, load_versions, versions_file_for
|
||||
from .base_scraper import fetch_text
|
||||
from scraper.base_scraper import fetch_text
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@@ -12,9 +12,9 @@ from pathlib import Path
|
||||
from core import upstream
|
||||
from core import forgehttp
|
||||
from core.paths import REPO_ROOT
|
||||
from scripts.scraper import game_dat_importer
|
||||
from scripts.scraper.dat_fetch import is_tracked_dat, label_version
|
||||
from scripts.scraper.redump_dat_scraper import fetch_snapshot
|
||||
from scripts.scraper.dats import game_dat_importer
|
||||
from scripts.scraper.arcade.dat_fetch import is_tracked_dat, label_version
|
||||
from scripts.scraper.dats.redump_dat_scraper import fetch_snapshot
|
||||
from freshness.findings import (
|
||||
FBNEO_RECIPES, MAME_RECIPES, NO_INTRO_GAMES, OK, REDUMP_GAMES, SKIPPED, STALE, UNKNOWN,
|
||||
Finding,
|
||||
|
||||
@@ -37,13 +37,13 @@ def _check_buildbot_system(platforms_dir: Path) -> Finding:
|
||||
The registry entries are refreshed above. An asset published since, or
|
||||
one the buildbot no longer serves, is only seen by reading its .index.
|
||||
"""
|
||||
from scraper import buildbot_system
|
||||
from freshness import buildbot
|
||||
|
||||
with contextlib.redirect_stdout(io.StringIO()):
|
||||
report = buildbot_system.check(str(platforms_dir / Path(DATA_DIRS_FILE).name))
|
||||
report = buildbot.check(str(platforms_dir / Path(DATA_DIRS_FILE).name))
|
||||
if report.get("error"):
|
||||
return Finding("data", "buildbot system", UNKNOWN, detail="index unreachable")
|
||||
todo = buildbot_system.pending(report)
|
||||
todo = buildbot.pending(report)
|
||||
if not todo:
|
||||
return Finding("data", "buildbot system", OK)
|
||||
every = [f"{e['status'].lower()} {e['zip']}" for e in todo]
|
||||
|
||||
@@ -120,7 +120,7 @@ def _catalog_command(subject: str, registry: dict[str, dict]) -> list[str] | Non
|
||||
return [
|
||||
sys.executable,
|
||||
"-m",
|
||||
"scripts.scraper.romset_dat_importer",
|
||||
"scripts.scraper.arcade.romset_dat_importer",
|
||||
"--source",
|
||||
_RECIPE_SOURCES[subject],
|
||||
"--fetch",
|
||||
@@ -130,7 +130,7 @@ def _catalog_command(subject: str, registry: dict[str, dict]) -> list[str] | Non
|
||||
return [
|
||||
sys.executable,
|
||||
"-m",
|
||||
"scripts.scraper.game_dat_importer",
|
||||
"scripts.scraper.dats.game_dat_importer",
|
||||
"--source",
|
||||
_GAME_SOURCES[subject],
|
||||
"--fetch",
|
||||
|
||||
@@ -103,7 +103,7 @@ def refresh_steps(args: argparse.Namespace, results: dict) -> bool:
|
||||
# Step 2a: Refresh MAME BIOS hashes
|
||||
if not args.offline:
|
||||
ok, _ = runner.run(
|
||||
[sys.executable, "-m", "scripts.scraper.mame_hash_scraper"],
|
||||
[sys.executable, "-m", "scripts.scraper.arcade.mame_hash_scraper"],
|
||||
STEP_LABELS["mame_hashes"],
|
||||
)
|
||||
results["mame_hashes"] = ok
|
||||
@@ -115,7 +115,7 @@ def refresh_steps(args: argparse.Namespace, results: dict) -> bool:
|
||||
# Step 2a2: Refresh FBNeo BIOS hashes
|
||||
if not args.offline:
|
||||
ok, _ = runner.run(
|
||||
[sys.executable, "-m", "scripts.scraper.fbneo_hash_scraper"],
|
||||
[sys.executable, "-m", "scripts.scraper.arcade.fbneo_hash_scraper"],
|
||||
STEP_LABELS["fbneo_hashes"],
|
||||
)
|
||||
results["fbneo_hashes"] = ok
|
||||
|
||||
@@ -8,8 +8,8 @@ from dataclasses import dataclass
|
||||
from core import upstream
|
||||
from model.sources import source_yaml_file
|
||||
from profiling.citations import collect_citations
|
||||
from scraper.clex import blank_comments
|
||||
from scraper.mame_parser import MACHINE_MACROS
|
||||
from scraper.arcade.clex import blank_comments
|
||||
from scraper.arcade.mame_parser import MACHINE_MACROS
|
||||
|
||||
# An optional role word names the repository the lines are in.
|
||||
DRIVER_REF = re.compile(r"^(?:(source|upstream) )?(src/[\w./+-]+):(\d+)$")
|
||||
|
||||
@@ -23,11 +23,11 @@ Mapping (stale -> command):
|
||||
-o platforms/targets/<name>.yml
|
||||
data/<key> python scripts/refresh_data_dirs.py --key <key>
|
||||
--force
|
||||
catalogs/mame recipes python -m scripts.scraper.romset_dat_importer
|
||||
catalogs/mame recipes python -m scripts.scraper.arcade.romset_dat_importer
|
||||
--source mame --fetch
|
||||
catalogs/fbneo recipes python -m scripts.scraper.romset_dat_importer
|
||||
catalogs/fbneo recipes python -m scripts.scraper.arcade.romset_dat_importer
|
||||
--source fbneo --fetch
|
||||
catalogs/no-intro games python -m scripts.scraper.game_dat_importer
|
||||
catalogs/no-intro games python -m scripts.scraper.dats.game_dat_importer
|
||||
catalogs/redump games --source <source> --fetch --refresh --floor
|
||||
ci/install.py pin python scripts/pin_installer.py
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ PLACE_KINDS = ("names_searched", "fixed_name", "core_option", "links")
|
||||
# How each launcher extractor spells the BIOS directory in search_dir, as the
|
||||
# platform's own scripts name it: RetroPie's scriptmodules ($biosdir,
|
||||
# retropie_reader.BIOSDIR), EmuDeck's EmuScripts (${biosPath},
|
||||
# emudeck_launchers.BIOS) and RetroDECK's framework ($bios_path,
|
||||
# retrodeck_launchers.BIOS).
|
||||
# launchers.emudeck.BIOS) and RetroDECK's framework ($bios_path,
|
||||
# launchers.retrodeck.BIOS).
|
||||
BIOS_ROOT_TOKENS = ("$biosdir", "${biosdir}", "${biosPath}", "$bios_path", "${bios_path}")
|
||||
|
||||
# A path spelled from a home or filesystem root names the BIOS directory by
|
||||
@@ -139,7 +139,7 @@ def name_settings(record: dict, names: list[str]) -> dict[str, str]:
|
||||
"""The setting each name of a record is written to.
|
||||
|
||||
A record naming several files of one config spells passes_to as
|
||||
describe_keys does (shell_launchers.py), "atari800.cfg ROM_OS_A_PAL,
|
||||
describe_keys does (launchers/shell.py), "atari800.cfg ROM_OS_A_PAL,
|
||||
ROM_5200_A, ...", one key per name and in the order of the names. When
|
||||
the counts differ, each name keeps the whole description.
|
||||
"""
|
||||
|
||||
@@ -20,7 +20,7 @@ from resolve.launcherplaces import bios_relative, record_directories
|
||||
BIOS_ROOT_VARIABLES = ("$biosdir", "$home/RetroPie/BIOS", "${biosPath}", "$bios_path")
|
||||
|
||||
# The name a platform's launch code gives its roms root: RetroDECK's
|
||||
# component scripts write $roms_path (retrodeck_launchers), the setting whose
|
||||
# component scripts write $roms_path (launchers/retrodeck.py), the setting whose
|
||||
# default is the roms root (config/retrodeck/retrodeck.json:5), RetroPie's
|
||||
# scriptmodules $romdir (retropie_packages.sh:47-49).
|
||||
ROMS_ROOT_VARIABLES = ("$roms_path", "${roms_path}", "$romdir", "${romdir}")
|
||||
|
||||
@@ -20,7 +20,7 @@ def print_survey(result: dict) -> None:
|
||||
if not result["dat_recipes"]:
|
||||
print(
|
||||
" No DAT recipe: import one with "
|
||||
"`python -m scripts.scraper.romset_dat_importer --source mame --fetch mame0289`"
|
||||
"`python -m scripts.scraper.arcade.romset_dat_importer --source mame --fetch mame0289`"
|
||||
)
|
||||
for problem in result.get("unreadable_archives", []):
|
||||
print(f" UNREADABLE: {problem}")
|
||||
|
||||
@@ -61,7 +61,7 @@ def arcade_pin_errors() -> list[str]:
|
||||
f"the profile says {profile.get('core_version')!r}")
|
||||
if drifted:
|
||||
out.append(f"{label}: {'; '.join(drifted)} "
|
||||
f"(python -m scripts.scraper.arcade_parent_importer --profile {doc.get('profile')})")
|
||||
f"(python -m scripts.scraper.arcade.arcade_parent_importer --profile {doc.get('profile')})")
|
||||
return out
|
||||
|
||||
|
||||
|
||||
+14
-44
@@ -1,54 +1,24 @@
|
||||
"""Scraper plugin discovery module.
|
||||
"""Readers of upstream sources, each written to a file of this repository.
|
||||
|
||||
Auto-detects *_scraper.py files and exposes their scrapers.
|
||||
Each scraper module must define:
|
||||
PLATFORM_NAME: str
|
||||
Scraper: class inheriting BaseScraper
|
||||
The `<name>_scraper.py` modules at this level each read one platform's BIOS
|
||||
list into `platforms/<platform>.yml`: the registry's `scraper:` field names
|
||||
the module, and `freshness.scrapers.platform_scraper` turns it into the
|
||||
command that runs it. base_scraper.py holds what they share, the network
|
||||
access included. The subpackages hold the other subjects: `targets/` the
|
||||
cores each hardware target ships, `romfolders/` each setup's rom folders,
|
||||
`launchers/` what each platform's launch code reads and passes to a core,
|
||||
`arcade/` the MAME and FBNeo hashes and romset recipes, and `dats/` the dump
|
||||
catalogs read from DAT files.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
import pkgutil
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# Scrapers run both as `python -m scripts.scraper.x` and as plain scripts, and
|
||||
# they share helpers with the rest of scripts/. Putting that directory on the
|
||||
# path once here is what lets every submodule say `from core.cli import ...`
|
||||
# instead of carrying its own bootstrap.
|
||||
# Scrapers run both as `python -m scripts.scraper.<module>` and as plain
|
||||
# scripts, and they share helpers with the rest of scripts/. Putting that
|
||||
# directory on the path once here is what lets every submodule say
|
||||
# `from core.cli import ...` instead of carrying its own bootstrap.
|
||||
if (_SCRIPTS_DIR := str(Path(__file__).resolve().parent.parent)) not in sys.path:
|
||||
sys.path.insert(0, _SCRIPTS_DIR)
|
||||
|
||||
from .base_scraper import BaseScraper
|
||||
|
||||
_scrapers: dict[str, type] = {}
|
||||
|
||||
|
||||
def discover_scrapers() -> dict[str, type]:
|
||||
"""Auto-discover all *_scraper.py modules and return {platform_name: ScraperClass}."""
|
||||
if _scrapers:
|
||||
return _scrapers
|
||||
|
||||
package_dir = Path(__file__).parent
|
||||
|
||||
for _finder, name, _ispkg in pkgutil.iter_modules([str(package_dir)]):
|
||||
if not name.endswith("_scraper"):
|
||||
continue
|
||||
|
||||
module = importlib.import_module(f".{name}", package=__package__)
|
||||
|
||||
platform_name = getattr(module, "PLATFORM_NAME", None)
|
||||
scraper_class = getattr(module, "Scraper", None)
|
||||
|
||||
if platform_name and scraper_class and issubclass(scraper_class, BaseScraper):
|
||||
_scrapers[platform_name] = scraper_class
|
||||
|
||||
return _scrapers
|
||||
|
||||
|
||||
def get_scraper(platform_name: str) -> BaseScraper | None:
|
||||
"""Get an instantiated scraper for a platform."""
|
||||
scrapers = discover_scrapers()
|
||||
cls = scrapers.get(platform_name)
|
||||
return cls() if cls else None
|
||||
@@ -24,7 +24,7 @@ Verification (batocera-systems at that commit):
|
||||
`--strictfilter`, which the script's argument switch (lines 665-687) does
|
||||
not handle: that call prints nothing and exits 0.
|
||||
|
||||
The launcher layer is read at the same commit (amberelec_launchers): runemu.py,
|
||||
The launcher layer is read at the same commit (launchers/amberelec.py): runemu.py,
|
||||
the scripts its standalone table runs and the configs their packages install.
|
||||
"""
|
||||
|
||||
@@ -33,7 +33,7 @@ from __future__ import annotations
|
||||
import re
|
||||
|
||||
from model.targets import not_cores
|
||||
from .amberelec_launchers import extract_launchers
|
||||
from .launchers.amberelec import extract_launchers
|
||||
from .base_scraper import fetch_text, github_json
|
||||
from .batocera_scraper import (
|
||||
SYSTEM_SLUG_MAP as BATOCERA_SLUGS,
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
"""MAME and FBNeo: the BIOS set hashes read from their source, merged into the
|
||||
emulator profiles, the romset recipes read from their DATs, and the BIOS set
|
||||
each arcade game loads.
|
||||
"""
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -10,7 +10,7 @@ from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
from .arcade_sets import SetEntry
|
||||
from .base_scraper import BlobMismatchError, download
|
||||
from ..base_scraper import BlobMismatchError, download
|
||||
from .clex import DriverSourceError, blank_comments, call_args, call_span
|
||||
from .dat_fetch import api_json
|
||||
from core.hashing import git_blob_sha
|
||||
+5
-5
@@ -9,9 +9,9 @@ own archive. The answer is read at the revision the profile pins, from the
|
||||
DAT of the core version that runs the game where that DAT is the code's own
|
||||
output, and from the driver code where it is not:
|
||||
|
||||
python -m scripts.scraper.arcade_parent_importer --all
|
||||
python -m scripts.scraper.arcade_parent_importer --profile mame2003_plus
|
||||
python -m scripts.scraper.arcade_parent_importer --all --offline
|
||||
python -m scripts.scraper.arcade.arcade_parent_importer --all
|
||||
python -m scripts.scraper.arcade.arcade_parent_importer --profile mame2003_plus
|
||||
python -m scripts.scraper.arcade.arcade_parent_importer --all --offline
|
||||
|
||||
A BIOS set is ``isbios="yes"`` (MAME 0.139 and later, FBNeo). mame2000,
|
||||
mame2003 and mame2003-plus carry a DAT in metadata/ that their code has
|
||||
@@ -50,8 +50,8 @@ from model.profiles import load_emulator_profiles
|
||||
from core.cli import add_repo_inputs, run_cli
|
||||
from core.hashing import compute_hashes, git_blob_sha
|
||||
from core.upstream import parse_repo
|
||||
from .base_scraper import fetch_verified_blob
|
||||
from .listxml import Opener, open_listxml
|
||||
from ..base_scraper import fetch_verified_blob
|
||||
from ..dats.listxml import Opener, open_listxml
|
||||
from model.mamerelease import mame_tag
|
||||
from .dat_fetch import MAME_LISTXML_URL, api_json, cached_pack, fetch_pack
|
||||
from .arcade_drivers import driver_source_sets, fetch_driver_source
|
||||
@@ -10,7 +10,7 @@ from typing import IO
|
||||
|
||||
from .clex import blank_comments
|
||||
from .fbneo_parser import zip_name
|
||||
from .listxml import Opener, attrs, iter_elements, rom_members
|
||||
from ..dats.listxml import Opener, attrs, iter_elements, rom_members
|
||||
|
||||
|
||||
@dataclass
|
||||
File renamed without changes.
@@ -6,7 +6,7 @@ import re
|
||||
from pathlib import Path
|
||||
|
||||
from core.hashing import git_blob_sha
|
||||
from .base_scraper import (
|
||||
from ..base_scraper import (
|
||||
BlobMismatchError,
|
||||
download,
|
||||
fetch_branch_head,
|
||||
+4
-4
@@ -25,10 +25,10 @@ from model.profiles import source_yaml_paths
|
||||
from core.artifacts import write_text_atomic
|
||||
from model.safeparse import yaml_load
|
||||
|
||||
from scripts.scraper._hash_merge import compute_diff, load_profile, merge_fbneo_profile
|
||||
from scripts.scraper._hash_write import write_fbneo_profile
|
||||
from scripts.scraper.fbneo_parser import parse_fbneo_source_tree
|
||||
from scripts.scraper.sparse_clone import fresh_cache, remove_clone, sparse_clone
|
||||
from ._hash_merge import compute_diff, load_profile, merge_fbneo_profile
|
||||
from ._hash_write import write_fbneo_profile
|
||||
from .fbneo_parser import parse_fbneo_source_tree
|
||||
from .sparse_clone import fresh_cache, remove_clone, sparse_clone
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
File renamed without changes.
@@ -28,7 +28,7 @@ from model.safeparse import yaml_load
|
||||
|
||||
from ._hash_write import generated_start
|
||||
from .clex import blank_comments
|
||||
from .listxml import LISTXML_CHUNK, attrs, iter_elements, rom_members
|
||||
from ..dats.listxml import LISTXML_CHUNK, attrs, iter_elements, rom_members
|
||||
from .mame_parser import _collect_rom_macros, _expand_macros, _parse_rom_entries
|
||||
|
||||
_BUILD = re.compile(rb'<mame build="[^"]*\((mame\d+)\)"')
|
||||
@@ -31,7 +31,7 @@ from core.cli import SourceUnreadable
|
||||
from core import upstream
|
||||
from core import upstreamtree
|
||||
|
||||
from .base_scraper import fetch_github_latest_version
|
||||
from ..base_scraper import fetch_github_latest_version
|
||||
from ._hash_merge import (
|
||||
_build_contents,
|
||||
_build_source_ref,
|
||||
@@ -56,7 +56,7 @@ from .mame_devices import (
|
||||
scan_release,
|
||||
source_path,
|
||||
)
|
||||
from .listxml import open_listxml
|
||||
from ..dats.listxml import open_listxml
|
||||
from model.mamerelease import mame_tag, mame_version
|
||||
from .dat_fetch import fetch_pack
|
||||
from .sparse_clone import fresh_cache, remove_clone, sparse_clone
|
||||
File renamed without changes.
+8
-8
@@ -8,11 +8,11 @@ documents every set of one version at once.
|
||||
MAME ships its ``-listxml`` output as a release asset and FBNeo keeps its DATs
|
||||
in its repository, so both are fetched without a browser:
|
||||
|
||||
python -m scripts.scraper.romset_dat_importer --source mame --fetch
|
||||
python -m scripts.scraper.romset_dat_importer --source mame --fetch mame0289
|
||||
python -m scripts.scraper.romset_dat_importer --source fbneo --fetch
|
||||
python -m scripts.scraper.romset_dat_importer --source fbneo --fetch v1.0.0.02
|
||||
python -m scripts.scraper.romset_dat_importer --source mame --pack local.dat
|
||||
python -m scripts.scraper.arcade.romset_dat_importer --source mame --fetch
|
||||
python -m scripts.scraper.arcade.romset_dat_importer --source mame --fetch mame0289
|
||||
python -m scripts.scraper.arcade.romset_dat_importer --source fbneo --fetch
|
||||
python -m scripts.scraper.arcade.romset_dat_importer --source fbneo --fetch v1.0.0.02
|
||||
python -m scripts.scraper.arcade.romset_dat_importer --source mame --pack local.dat
|
||||
|
||||
Only sets the collection has a reason to know are kept, so the committed
|
||||
snapshot stays small: the archive names that emulator profiles or platform
|
||||
@@ -49,9 +49,9 @@ from core.cli import add_repo_inputs, run_cli
|
||||
from model.database import load_database
|
||||
from model.dumpcatalog import build_snapshot, load_provenance_snapshots, write_snapshot
|
||||
from resolve.lookup import variant_base_name
|
||||
from .base_scraper import BlobMismatchError, fetch_github_latest_version
|
||||
from ..base_scraper import BlobMismatchError, fetch_github_latest_version
|
||||
from .dat_fetch import fetch_pack, mame_label
|
||||
from .listxml import (
|
||||
from ..dats.listxml import (
|
||||
Opener,
|
||||
iter_dat_documents,
|
||||
iter_elements,
|
||||
@@ -59,7 +59,7 @@ from .listxml import (
|
||||
rom_members,
|
||||
xml_members,
|
||||
)
|
||||
from .logiqx_parser import LogiqxDat, parse_logiqx
|
||||
from ..dats.logiqx_parser import LogiqxDat, parse_logiqx
|
||||
|
||||
SOURCES = ("mame", "fbneo")
|
||||
DEFAULT_OUTPUT = f"{RECIPES_DIR}/{{source}}.json"
|
||||
File renamed without changes.
@@ -32,8 +32,8 @@ from .base_scraper import (
|
||||
optional_core_lists,
|
||||
systems_from_requirements,
|
||||
)
|
||||
from .batocera_configgen import Configgen, configs_root
|
||||
from .batocera_launchers import extract_launchers
|
||||
from .launchers.batocera_configgen import Configgen, configs_root
|
||||
from .launchers.batocera import extract_launchers
|
||||
from .es_systems import es_systems_emulators, es_systems_libretro, es_systems_libretro_systems
|
||||
from .targets.batocera_targets_scraper import BuildSelection
|
||||
from .targets.batocera_targets_scraper import Scraper as BoardTargets
|
||||
|
||||
@@ -27,7 +27,7 @@ from .base_scraper import (
|
||||
fetch_github_latest_version,
|
||||
scraper_cli,
|
||||
)
|
||||
from .csharp_source import blank_comments
|
||||
from .launchers.csharp_source import blank_comments
|
||||
|
||||
PLATFORM_NAME = "bizhawk"
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
"""DAT files and the dump catalogs read from them: the Logiqx, clrmamepro and
|
||||
-listxml readers, the No-Intro, Redump and TOSEC BIOS snapshots under
|
||||
provenance/, and the game catalogs under games/catalogs/.
|
||||
"""
|
||||
@@ -3,8 +3,8 @@
|
||||
Dat-o-Matic blocks automated downloads and TOSEC ships yearly packs,
|
||||
so both are imported from a locally downloaded archive:
|
||||
|
||||
python -m scripts.scraper.dat_pack_importer --source no-intro --pack lovepack.zip
|
||||
python -m scripts.scraper.dat_pack_importer --source tosec --pack TOSEC-v2025-03-13.zip
|
||||
python -m scripts.scraper.dats.dat_pack_importer --source no-intro --pack lovepack.zip
|
||||
python -m scripts.scraper.dats.dat_pack_importer --source tosec --pack TOSEC-v2025-03-13.zip
|
||||
|
||||
No-Intro marks BIOS dumps with a "[BIOS]" game name prefix inside the
|
||||
system DATs. TOSEC groups firmware into dedicated DATs whose name
|
||||
File renamed without changes.
@@ -7,10 +7,10 @@ those keys with the title and the territory the DAT names the game for.
|
||||
They are game catalogues, not dump catalogues of BIOS files, so they live in
|
||||
games/catalogs/ and never in provenance/.
|
||||
|
||||
python -m scripts.scraper.game_dat_importer --fetch
|
||||
python -m scripts.scraper.game_dat_importer --fetch --source redump
|
||||
python -m scripts.scraper.game_dat_importer --offline --floor
|
||||
python -m scripts.scraper.game_dat_importer --source no-intro --pack no-intro.zip
|
||||
python -m scripts.scraper.dats.game_dat_importer --fetch
|
||||
python -m scripts.scraper.dats.game_dat_importer --fetch --source redump
|
||||
python -m scripts.scraper.dats.game_dat_importer --offline --floor
|
||||
python -m scripts.scraper.dats.game_dat_importer --source no-intro --pack no-intro.zip
|
||||
|
||||
No-Intro comes from the auto-datfile-generator release asset (Dat-o-Matic
|
||||
bans automated clients), Redump from redump.info's per-system datfile route.
|
||||
@@ -32,14 +32,11 @@ import sys
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
|
||||
if (_SCRIPTS_DIR := str(Path(__file__).resolve().parents[1])) not in sys.path:
|
||||
sys.path.insert(0, _SCRIPTS_DIR)
|
||||
|
||||
from core.artifacts import write_if_changed, write_text_atomic
|
||||
from model.region import REGIONS, WORLD
|
||||
from model.region import NOINTRO
|
||||
|
||||
from .base_scraper import download, github_json
|
||||
from ..base_scraper import download, github_json
|
||||
from .listxml import iter_dat_documents
|
||||
from .logiqx_parser import LogiqxGame, LogiqxRom, parse_logiqx_games
|
||||
|
||||
@@ -136,7 +133,7 @@ LICENCES: dict[str, dict] = {
|
||||
},
|
||||
}
|
||||
|
||||
# Territory words the DATs use that scripts/region.py has no member slug
|
||||
# Territory words the DATs use that scripts/model/region.py has no member slug
|
||||
# for. Each falls under the one super-region that contains it.
|
||||
EXTRA_TERRITORIES = {
|
||||
"Scandinavia": "europe",
|
||||
@@ -198,7 +195,7 @@ def name_regions(name: str) -> list[str] | None:
|
||||
return [WORLD]
|
||||
unknown = set(slugs) - REGIONS
|
||||
if unknown:
|
||||
raise ValueError(f"region slugs {sorted(unknown)} are outside scripts/region.py")
|
||||
raise ValueError(f"region slugs {sorted(unknown)} are outside scripts/model/region.py")
|
||||
return slugs
|
||||
return None
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -8,8 +8,8 @@ downloads page is scanned for either shape, so new BIOS DATs are
|
||||
picked up without code changes.
|
||||
|
||||
Run manually, then commit the snapshot:
|
||||
python -m scripts.scraper.redump_dat_scraper --dry-run
|
||||
python -m scripts.scraper.redump_dat_scraper --output provenance/redump.json
|
||||
python -m scripts.scraper.dats.redump_dat_scraper --dry-run
|
||||
python -m scripts.scraper.dats.redump_dat_scraper --output provenance/redump.json
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -21,7 +21,7 @@ from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
|
||||
from model.dumpcatalog import write_provenance_snapshot
|
||||
from .base_scraper import fetch_bytes
|
||||
from ..base_scraper import fetch_bytes
|
||||
from .logiqx_parser import parse_logiqx, validate_logiqx_format
|
||||
|
||||
BASE_URL = "https://redump.info"
|
||||
@@ -25,8 +25,8 @@ from .base_scraper import (
|
||||
github_json,
|
||||
systems_from_requirements,
|
||||
)
|
||||
from .emudeck_launchers import emulator_of_script, extract_launchers
|
||||
from scraper.shell_launchers import RepoTree
|
||||
from .launchers.emudeck import emulator_of_script, extract_launchers
|
||||
from scraper.launchers.shell import RepoTree
|
||||
|
||||
PLATFORM_NAME = "emudeck"
|
||||
|
||||
|
||||
@@ -36,14 +36,14 @@ from .batocera_scraper import (
|
||||
from .batocera_scraper import (
|
||||
CheckBiosScraper,
|
||||
)
|
||||
from .emuelec_launchers import extract_launchers
|
||||
from .launchers.emuelec import extract_launchers
|
||||
from .es_emulators import (
|
||||
attach_system_cores,
|
||||
es_cores,
|
||||
json_systems,
|
||||
system_cores,
|
||||
)
|
||||
from scraper.shell_launchers import RepoTree
|
||||
from scraper.launchers.shell import RepoTree
|
||||
from .emuelec_systems import (
|
||||
BUILDS_OF,
|
||||
ES_SYSTEMS_TEMPLATE,
|
||||
|
||||
@@ -20,7 +20,7 @@ Verification (knulli-systems at the release tag):
|
||||
|
||||
es_systems.yml and configgen-defaults.yml have Batocera's shape, so the cores
|
||||
are read with Batocera's code. The launcher layer comes from KNULLI's own
|
||||
configgen package and board scripts at the same tag (knulli_launchers):
|
||||
configgen package and board scripts at the same tag (launchers/knulli.py):
|
||||
Batocera's extractors where a generator is still Batocera's code, KNULLI's
|
||||
where it is older or its own.
|
||||
"""
|
||||
@@ -48,9 +48,9 @@ from .batocera_scraper import (
|
||||
from .es_emulators import attach_system_cores
|
||||
from .es_systems import es_systems_by_system, es_systems_libretro_systems
|
||||
from .targets.knulli_targets_scraper import Scraper as BoardTargets
|
||||
from .batocera_configgen import configs_root
|
||||
from .knulli_launchers import BATOCERA_SUBMODULE, extract_launchers
|
||||
from .knulli_launchers import configgen as knulli_configgen
|
||||
from .launchers.batocera_configgen import configs_root
|
||||
from .launchers.knulli import BATOCERA_SUBMODULE, extract_launchers
|
||||
from .launchers.knulli import configgen as knulli_configgen
|
||||
|
||||
PLATFORM_NAME = "knulli"
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
"""The launcher layer of each platform: what its launch code looks for, under
|
||||
which name and in which folder, and what it hands to the core or emulator,
|
||||
read from that code at the revision the platform file pins.
|
||||
|
||||
One module per platform reads its launchers (batocera.py, retrobat.py...).
|
||||
configgen.py holds the record every reader returns and the errors a reader
|
||||
raises when the code no longer has the shape it reads. shell.py and
|
||||
csharp_source.py read the shell and C# sources several platforms share.
|
||||
"""
|
||||
@@ -9,7 +9,7 @@ install, say which file under /storage/roms/bios is opened: yabasanshiro.sh
|
||||
tests saturn_bios.bin and passes it with -b, Hatari's default config names
|
||||
tos.img.
|
||||
|
||||
runemu.py is read with ast, the scripts with shell_launchers' readers. An
|
||||
runemu.py is read with ast, the scripts with shell.py's readers. An
|
||||
extractor whose construct is gone raises instead of returning nothing.
|
||||
"""
|
||||
|
||||
@@ -21,8 +21,8 @@ import re
|
||||
from collections.abc import Callable
|
||||
from typing import Any
|
||||
|
||||
from .configgen_launchers import Launcher, Source
|
||||
from scraper.shell_launchers import (
|
||||
from .configgen import Launcher, Source
|
||||
from scraper.launchers.shell import (
|
||||
LauncherPatternMissing,
|
||||
Script,
|
||||
config_placement,
|
||||
@@ -21,7 +21,7 @@ from dataclasses import dataclass
|
||||
from typing import Any
|
||||
|
||||
from model.launcherrecords import emulator_names, join_emulators
|
||||
from .configgen_launchers import (
|
||||
from .configgen import (
|
||||
Launcher,
|
||||
LauncherShapeError,
|
||||
end_line,
|
||||
+1
-1
@@ -7,7 +7,7 @@ from collections.abc import Callable
|
||||
|
||||
from .batocera_configgen import Configgen, _path_value
|
||||
from .batocera_searches import option_names
|
||||
from .configgen_launchers import (
|
||||
from .configgen import (
|
||||
Launcher,
|
||||
Source,
|
||||
_assigned_name,
|
||||
+1
-1
@@ -10,7 +10,7 @@ from collections.abc import Callable
|
||||
from typing import Any
|
||||
|
||||
from model.launcherrecords import join_emulators
|
||||
from .configgen_launchers import LauncherShapeError, Source, _assigned_name, assigned_value
|
||||
from .configgen import LauncherShapeError, Source, _assigned_name, assigned_value
|
||||
|
||||
|
||||
CONFIGGEN = "package/batocera/core/batocera-configgen/configgen/configgen"
|
||||
+1
-1
@@ -5,7 +5,7 @@ from __future__ import annotations
|
||||
import ast
|
||||
|
||||
from .batocera_configgen import Configgen, _config_option, _path_value
|
||||
from .configgen_launchers import (
|
||||
from .configgen import (
|
||||
Launcher,
|
||||
Source,
|
||||
_assigned_name,
|
||||
File renamed without changes.
@@ -15,7 +15,7 @@ from dataclasses import dataclass, field
|
||||
|
||||
from model.launcherrecords import join_emulators
|
||||
from .batocera_configgen import Configgen, _path_value
|
||||
from .configgen_launchers import Launcher, Source, _assigned_name, end_line
|
||||
from .configgen import Launcher, Source, _assigned_name, end_line
|
||||
|
||||
|
||||
def _bound(node: ast.AST) -> ast.expr | None:
|
||||
@@ -11,8 +11,8 @@ from collections.abc import Iterator
|
||||
from core.lines import LineIndex
|
||||
from model.sourceref import span
|
||||
|
||||
from .configgen_launchers import LauncherPatternMissing
|
||||
from .shell_launchers import merge_lines
|
||||
from .configgen import LauncherPatternMissing
|
||||
from .shell import merge_lines
|
||||
|
||||
|
||||
STRING = r'"((?:[^"\\\n]|\\.)*)"'
|
||||
@@ -14,8 +14,8 @@ import posixpath
|
||||
import re
|
||||
from collections.abc import Callable
|
||||
|
||||
from .configgen_launchers import Launcher
|
||||
from scraper.shell_launchers import (
|
||||
from .configgen import Launcher
|
||||
from scraper.launchers.shell import (
|
||||
describe_keys,
|
||||
LauncherPatternMissing,
|
||||
link_record,
|
||||
@@ -16,8 +16,8 @@ import posixpath
|
||||
import re
|
||||
from collections.abc import Callable
|
||||
|
||||
from .configgen_launchers import Launcher
|
||||
from scraper.shell_launchers import (
|
||||
from .configgen import Launcher
|
||||
from scraper.launchers.shell import (
|
||||
describe_keys,
|
||||
fixed_paths,
|
||||
LauncherPatternMissing,
|
||||
@@ -7,8 +7,8 @@ import re
|
||||
from collections.abc import Iterable
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
from .configgen_launchers import Launcher
|
||||
from .shell_launchers import (
|
||||
from .configgen import Launcher
|
||||
from .shell import (
|
||||
RepoTree,
|
||||
Script,
|
||||
apply_evidence,
|
||||
@@ -28,7 +28,7 @@ from dataclasses import dataclass
|
||||
import yaml
|
||||
|
||||
from model.launcherrecords import emulator_names, join_emulators
|
||||
from .batocera_launchers import (
|
||||
from .batocera import (
|
||||
PATH_PATCHES,
|
||||
Extraction,
|
||||
extraction,
|
||||
@@ -40,13 +40,8 @@ from .batocera_launchers import (
|
||||
from .batocera_config_writes import render, system_branches, melonds, mupen64plus, x16emu, xemu
|
||||
from .batocera_searches import duckstation, duckstation_legacy, hatari
|
||||
from .batocera_configgen import Configgen, _path_value
|
||||
from .configgen_launchers import (
|
||||
Launcher,
|
||||
LauncherShapeError,
|
||||
Source,
|
||||
_assigned_name,
|
||||
)
|
||||
from scraper.shell_launchers import LauncherPatternMissing, Script, source_ref
|
||||
from .configgen import Launcher, LauncherShapeError, Source, _assigned_name
|
||||
from scraper.launchers.shell import LauncherPatternMissing, Script, source_ref
|
||||
from .configgen_sites import (
|
||||
COMMAND_NAMES,
|
||||
GenericSites,
|
||||
@@ -226,7 +221,7 @@ def _quoted(node: ast.AST) -> str | None:
|
||||
|
||||
|
||||
# libretro core options whose value names the BIOS file the core opens,
|
||||
# the same two batocera_launchers.FILE_OPTIONS reads.
|
||||
# the same two batocera.FILE_OPTIONS reads.
|
||||
FILE_OPTIONS = ("o2em_bios", "neocd_bios")
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ from collections.abc import Callable
|
||||
from typing import Any
|
||||
|
||||
from model.launcherrecords import emulator_names, join_emulators
|
||||
from .configgen_launchers import (
|
||||
from .configgen import (
|
||||
Launcher,
|
||||
LauncherShapeError,
|
||||
_assigned_name,
|
||||
+1
-1
@@ -7,7 +7,7 @@ import posixpath
|
||||
from collections.abc import Mapping
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
from .configgen_launchers import (
|
||||
from .configgen import (
|
||||
Launcher,
|
||||
Source,
|
||||
_assigned_name,
|
||||
+1
-1
@@ -8,7 +8,7 @@ import re
|
||||
from collections.abc import Callable, Iterable, Iterator, Mapping
|
||||
from typing import Any
|
||||
|
||||
from .configgen_launchers import LauncherShapeError, Source, _calls, assigned_value
|
||||
from .configgen import LauncherShapeError, Source, _calls, assigned_value
|
||||
from model.launcherrecords import join_emulators
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import ast
|
||||
from collections.abc import Mapping
|
||||
from functools import partial
|
||||
|
||||
from .configgen_launchers import (
|
||||
from .configgen import (
|
||||
Launcher,
|
||||
LauncherShapeError,
|
||||
Source,
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+7
-1
@@ -15,7 +15,13 @@ from .csharp_source import (
|
||||
_unique,
|
||||
source_ref,
|
||||
)
|
||||
from .retrobat_generators import BIOS, FEATURES, GENERATORS, launcher_record, feature_choices
|
||||
from .retrobat_generators import (
|
||||
BIOS,
|
||||
FEATURES,
|
||||
GENERATORS,
|
||||
launcher_record,
|
||||
feature_choices,
|
||||
)
|
||||
|
||||
|
||||
def pcsx2(sources: dict[str, Source]) -> list[Record]:
|
||||
File renamed without changes.
@@ -5,7 +5,14 @@ from __future__ import annotations
|
||||
import re
|
||||
|
||||
from .csharp_source import Record, Source, _array_at, _strings, _unique, source_ref
|
||||
from .retrobat_generators import BIOS, FEATURES, GENERATORS, joined, launcher_record, feature_choices
|
||||
from .retrobat_generators import (
|
||||
BIOS,
|
||||
FEATURES,
|
||||
GENERATORS,
|
||||
joined,
|
||||
launcher_record,
|
||||
feature_choices,
|
||||
)
|
||||
from model.launcherrecords import join_emulators
|
||||
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -11,8 +11,8 @@ from itertools import product
|
||||
from pathlib import PurePosixPath
|
||||
from typing import Any, ClassVar
|
||||
|
||||
from .configgen_launchers import Launcher as ConfiggenLauncher
|
||||
from .retropie_modules import module_field_lines
|
||||
from .configgen import Launcher as ConfiggenLauncher
|
||||
from ..retropie_modules import module_field_lines
|
||||
|
||||
|
||||
SCRIPTMODULES = "scriptmodules"
|
||||
@@ -479,7 +479,7 @@ def merge_records(records: list[Launcher]) -> list[Launcher]:
|
||||
|
||||
def source_ref(lines: list[tuple[str, int]]) -> str:
|
||||
"""`path:a-b, c` per file, in first-seen file order, adjacent lines joined."""
|
||||
# Not shell_launchers.merge_lines: joining across a one-line gap would turn
|
||||
# Not shell.merge_lines: joining across a one-line gap would turn
|
||||
# the committed lr-prboom.sh:86, 88 of four retropie.yml records into 86-88.
|
||||
by_path: dict[str, list[int]] = {}
|
||||
for path, number in lines:
|
||||
@@ -15,8 +15,8 @@ import posixpath
|
||||
import re
|
||||
from collections.abc import Callable
|
||||
|
||||
from .configgen_launchers import Launcher
|
||||
from scraper.shell_launchers import (
|
||||
from .configgen import Launcher
|
||||
from scraper.launchers.shell import (
|
||||
describe_keys,
|
||||
LauncherPatternMissing,
|
||||
Link,
|
||||
@@ -8,8 +8,8 @@ from collections.abc import Callable, Hashable
|
||||
from dataclasses import dataclass
|
||||
from typing import TypeVar
|
||||
|
||||
from .configgen_launchers import Launcher
|
||||
from .shell_launchers import (
|
||||
from .configgen import Launcher
|
||||
from .shell import (
|
||||
FixedPaths,
|
||||
LauncherPatternMissing,
|
||||
RepoTree,
|
||||
@@ -17,8 +17,8 @@ from dataclasses import dataclass, field
|
||||
|
||||
from model.sourceref import span
|
||||
|
||||
from .base_scraper import fetch_bytes, github_tree
|
||||
from .configgen_launchers import Launcher, LauncherPatternMissing
|
||||
from ..base_scraper import fetch_bytes, github_tree
|
||||
from .configgen import Launcher, LauncherPatternMissing
|
||||
|
||||
NAME = r"[A-Za-z_][A-Za-z0-9_]*"
|
||||
# A single-quoted "$" is literal: it is carried as this mark through expansion.
|
||||
@@ -17,7 +17,7 @@ from .base_scraper import (
|
||||
fetch_github_latest_version,
|
||||
systems_from_requirements,
|
||||
)
|
||||
from .dat_parser import parse_dat, parse_dat_metadata, validate_dat_format
|
||||
from .dats.dat_parser import parse_dat, parse_dat_metadata, validate_dat_format
|
||||
|
||||
PLATFORM_NAME = "libretro"
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ from core import upstreamtree
|
||||
from model.safeparse import parse_untrusted_xml
|
||||
|
||||
from .base_scraper import BaseScraper, BiosRequirement, fetch_bytes, systems_from_requirements
|
||||
from .recalbox_launchers import SOURCE_FILES as LAUNCHER_FILES
|
||||
from .recalbox_launchers import LauncherShapeError, extract_launchers
|
||||
from .launchers.recalbox import SOURCE_FILES as LAUNCHER_FILES
|
||||
from .launchers.recalbox import LauncherShapeError, extract_launchers
|
||||
from .recalbox_romfs import read_system_ini
|
||||
|
||||
PLATFORM_NAME = "recalbox"
|
||||
|
||||
@@ -24,8 +24,8 @@ from .base_scraper import (
|
||||
)
|
||||
from .batocera_scraper import SYSTEM_SLUG_MAP as BATOCERA_SLUGS
|
||||
from .es_emulators import es_cores, libretro_systems, xml_systems
|
||||
from .retrobat_launchers import SOURCE_FILES as LAUNCHER_FILES
|
||||
from .retrobat_launchers import extract_launchers
|
||||
from .launchers.retrobat import SOURCE_FILES as LAUNCHER_FILES
|
||||
from .launchers.retrobat import extract_launchers
|
||||
|
||||
PLATFORM_NAME = "retrobat"
|
||||
PLATFORM_FILE = Path(__file__).resolve().parents[2] / "platforms" / "retrobat.yml"
|
||||
|
||||
@@ -56,7 +56,7 @@ from .base_scraper import (
|
||||
md5_field,
|
||||
systems_from_requirements,
|
||||
)
|
||||
from .retrodeck_launchers import extract_launchers
|
||||
from .launchers.retrodeck import extract_launchers
|
||||
from .romfolders.esde import command_core, esde_systems
|
||||
|
||||
PLATFORM_NAME = "retrodeck"
|
||||
|
||||
@@ -16,7 +16,7 @@ RetroArch: RetroPie claimed every libretro core in existence while shipping
|
||||
(openmsx, pcsx2, xroar, sdltrs, amiberry and the rest). Both halves were
|
||||
wrong, in opposite directions.
|
||||
|
||||
The same scripts carry the launcher layer (retropie_launchers): where each
|
||||
The same scripts carry the launcher layer (launchers/retropie.py): where each
|
||||
package links, copies or passes a BIOS file, what it builds and which
|
||||
systems it registers.
|
||||
"""
|
||||
@@ -29,9 +29,9 @@ import tarfile
|
||||
from collections.abc import Iterator
|
||||
|
||||
from .base_scraper import BaseScraper, BiosRequirement, fetch_branch_head, fetch_bytes
|
||||
from .retropie_scripts import SCRIPTMODULES
|
||||
from .retropie_scripts import SECTIONS as PACKAGE_SECTIONS
|
||||
from .retropie_launchers import extract_launchers
|
||||
from .launchers.retropie_scripts import SCRIPTMODULES
|
||||
from .launchers.retropie_scripts import SECTIONS as PACKAGE_SECTIONS
|
||||
from .launchers.retropie import extract_launchers
|
||||
from .retropie_modules import module_fields
|
||||
|
||||
PLATFORM_NAME = "retropie"
|
||||
|
||||
@@ -24,8 +24,8 @@ from .base_scraper import (
|
||||
fetch_text,
|
||||
github_json,
|
||||
)
|
||||
from .rocknix_launchers import extract_launchers
|
||||
from scraper.shell_launchers import RepoTree
|
||||
from .launchers.rocknix import extract_launchers
|
||||
from scraper.launchers.shell import RepoTree
|
||||
from .rocknix_packages import dual_mode_emulators, standalone_emulators
|
||||
from .targets.rocknix_targets_scraper import Scraper as DeviceTargets
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ from pathlib import Path
|
||||
|
||||
from model.safeparse import yaml_load
|
||||
|
||||
from ..emudeck_launchers import SCRIPT_SUFFIXES, emulator_of_script
|
||||
from ..launchers.emudeck import SCRIPT_SUFFIXES, emulator_of_script
|
||||
from . import BaseTargetScraper, fetch_text, forge_headers, target_cli
|
||||
|
||||
PLATFORM_NAME = "emudeck"
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
@@ -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",
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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()), \
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]))
|
||||
|
||||
@@ -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"])
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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])
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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>'
|
||||
|
||||
Loaded 100 of 130 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user