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
+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"
|
||||
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
"""The buildbot system directory compared with the data directory registry, by HTTP ETag."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import urllib.error
|
||||
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
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
BUILDBOT_SYSTEM_URL = "https://buildbot.libretro.com/assets/system/"
|
||||
INDEX_URL = BUILDBOT_SYSTEM_URL + ".index"
|
||||
|
||||
|
||||
|
||||
def fetch_index() -> set[str]:
|
||||
"""Fetch .index from buildbot, return set of ZIP filenames."""
|
||||
return {line.strip() for line in fetch_text(INDEX_URL).splitlines() if line.strip()}
|
||||
|
||||
|
||||
def load_tracked_entries(
|
||||
registry_path: str = DATA_DIRS_FILE,
|
||||
) -> dict[str, tuple[str, str]]:
|
||||
"""Load buildbot entries from _data_dirs.yml.
|
||||
|
||||
Returns {decoded_zip_name: (key, source_url)}.
|
||||
"""
|
||||
entries: dict[str, tuple[str, str]] = {}
|
||||
for key, entry in data_dir_registry_at(registry_path, required=True).items():
|
||||
url = entry.get("source_url", "")
|
||||
if "buildbot.libretro.com/assets/system" not in url:
|
||||
continue
|
||||
zip_name = urllib.parse.unquote(url.rsplit("/", 1)[-1])
|
||||
entries[zip_name] = (key, url)
|
||||
return entries
|
||||
|
||||
|
||||
def check(registry_path: str = DATA_DIRS_FILE) -> dict:
|
||||
"""Run the buildbot check. Returns structured report."""
|
||||
try:
|
||||
index_zips = fetch_index()
|
||||
except (urllib.error.URLError, OSError) as exc:
|
||||
log.warning("buildbot unreachable: %s", exc)
|
||||
return {"error": str(exc), "entries": []}
|
||||
|
||||
tracked = load_tracked_entries(registry_path)
|
||||
registry = data_dir_registry_at(registry_path, required=True)
|
||||
version_files: dict = {}
|
||||
|
||||
def stored_etag(key: str) -> str:
|
||||
path = versions_file_for(registry[key])
|
||||
if path not in version_files:
|
||||
version_files[path] = load_versions(path)
|
||||
return version_files[path].get(key, {}).get("sha", "")
|
||||
|
||||
buildbot_set = set(index_zips)
|
||||
tracked_set = set(tracked.keys())
|
||||
|
||||
results: list[dict] = [{"zip": z, "status": "NEW", "key": None} for z in sorted(buildbot_set - tracked_set)]
|
||||
|
||||
for z in sorted(tracked_set - buildbot_set):
|
||||
key, _ = tracked[z]
|
||||
results.append({"zip": z, "status": "STALE", "key": key})
|
||||
|
||||
for z in sorted(tracked_set & buildbot_set):
|
||||
key, url = tracked[z]
|
||||
stored = stored_etag(key)
|
||||
remote = get_remote_etag(url)
|
||||
if remote is None:
|
||||
status = "UNKNOWN"
|
||||
elif remote == stored:
|
||||
status = "OK"
|
||||
else:
|
||||
status = "UPDATED"
|
||||
results.append(
|
||||
{
|
||||
"zip": z,
|
||||
"status": status,
|
||||
"key": key,
|
||||
"stored_etag": stored,
|
||||
"remote_etag": remote or "",
|
||||
}
|
||||
)
|
||||
|
||||
return {"entries": results}
|
||||
|
||||
|
||||
def print_report(report: dict) -> None:
|
||||
"""Print human-readable report."""
|
||||
if report.get("error"):
|
||||
print(f"WARNING: {report['error']}")
|
||||
return
|
||||
entries = report["entries"]
|
||||
print(f"Buildbot system check ({len(entries)} entries):")
|
||||
for e in entries:
|
||||
pad = 40 - len(e["zip"])
|
||||
dots = "." * max(pad, 2)
|
||||
print(f" {e['zip']} {dots} {e['status']}")
|
||||
counts: dict[str, int] = {}
|
||||
for e in entries:
|
||||
counts[e["status"]] = counts.get(e["status"], 0) + 1
|
||||
parts = [f"{v} {k.lower()}" for k, v in sorted(counts.items())]
|
||||
print(f"\nSummary: {', '.join(parts)}")
|
||||
|
||||
|
||||
def updated(report: dict) -> list[str]:
|
||||
"""Keys of the tracked entries whose remote version changed."""
|
||||
return [e["key"] for e in report.get("entries", []) if e["status"] == "UPDATED" and e.get("key")]
|
||||
|
||||
|
||||
def pending(report: dict) -> list[dict]:
|
||||
"""Entries a maintainer has to act on: not tracked yet, or gone."""
|
||||
return [e for e in report.get("entries", []) if e["status"] in ("NEW", "STALE")]
|
||||
|
||||
|
||||
def unanswered(report: dict) -> list[dict]:
|
||||
"""Tracked entries whose remote version could not be read."""
|
||||
return [e for e in report.get("entries", []) if e["status"] == "UNKNOWN"]
|
||||
@@ -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"
|
||||
|
||||
Reference in new issue
Block a user