refactor: move leaf modules into packages

core: hashing, artifacts, ziptools, deterministic_zip, romdir, sect233r1,
crypto_verify, paths (REPO_ROOT). model: safeparse (needs yaml),
dumpcatalog, largefiles, alternatives. resolve: nativemode, validation,
launchers, slot, truth, gamedata, and exporter/baseline.py and
exporter/candidates.py as resolve/reconcile.py and resolve/categories.py,
which truth and gamedata read.

Every importer follows. Modules one level deeper read the repository
root from core.paths instead of __file__.
This commit is contained in:
Abdessamad Derraz committed 2026-11-18 10:50:45 +01:00
1 parent 23d8a770f1
commit c784aef883
167 files changed
+412 -434

No files matched your search

+29 -27
View File
@@ -11,32 +11,32 @@ on:
- "exports/**"
# Every script the build runs or imports, and no other
# (tests/test_workflow_paths.py).
- "scripts/alternatives.py"
- "scripts/archive_build.py"
- "scripts/artifacts.py"
- "scripts/auto_fetch.py"
- "scripts/build_port.py"
- "scripts/common.py"
- "scripts/core/artifacts.py"
- "scripts/core/crypto_verify.py"
- "scripts/core/deterministic_zip.py"
- "scripts/core/hashing.py"
- "scripts/core/paths.py"
- "scripts/core/romdir.py"
- "scripts/core/sect233r1.py"
- "scripts/core/ziptools.py"
- "scripts/cross_reference.py"
- "scripts/crypto_verify.py"
- "scripts/derivations.py"
- "scripts/dedup.py"
- "scripts/deterministic_zip.py"
- "scripts/dumpcatalog.py"
- "scripts/exporter/baseline.py"
- "scripts/exporter/candidates.py"
- "scripts/gamedata.py"
- "scripts/derivations.py"
- "scripts/generate_event_schema.py"
- "scripts/generate_pack.py"
- "scripts/generate_readme.py"
- "scripts/generate_site.py"
- "scripts/hashing.py"
- "scripts/indexnow.py"
- "scripts/largefiles.py"
- "scripts/launchers.py"
- "scripts/manifestselect.py"
- "scripts/measurement_records.py"
- "scripts/nativemode.py"
- "scripts/model/alternatives.py"
- "scripts/model/dumpcatalog.py"
- "scripts/model/largefiles.py"
- "scripts/model/safeparse.py"
- "scripts/packextras.py"
- "scripts/packpaths.py"
- "scripts/packreadme.py"
@@ -47,46 +47,48 @@ on:
- "scripts/refresh_data_dirs.py"
- "scripts/region.py"
- "scripts/release_record.py"
- "scripts/resolve/__init__.py"
- "scripts/resolve/categories.py"
- "scripts/resolve/gamedata.py"
- "scripts/resolve/launchers.py"
- "scripts/resolve/nativemode.py"
- "scripts/resolve/reconcile.py"
- "scripts/resolve/slot.py"
- "scripts/resolve/truth.py"
- "scripts/resolve/validation.py"
- "scripts/restore_large_files.py"
- "scripts/safeparse.py"
- "scripts/retired_files.py"
- "scripts/romset_recipes.py"
- "scripts/scraper/base_scraper.py"
- "scripts/scraper/configgen_launchers.py"
- "scripts/scraper/shell_launchers.py"
- "scripts/sect233r1.py"
- "scripts/siteagents.py"
- "scripts/site_markdown.py"
- "scripts/siteagents.py"
- "scripts/sitebootstrap.py"
- "scripts/sitehandheld.py"
- "scripts/sitewanted.py"
- "scripts/sitecollection.py"
- "scripts/sitediagrams.py"
- "scripts/siteentries.py"
- "scripts/siteexports.py"
- "scripts/siteguides.py"
- "scripts/sitehandheld.py"
- "scripts/siteinputs.py"
- "scripts/sitemarkup.py"
- "scripts/sitemeasurements.py"
- "scripts/siteexports.py"
- "scripts/siterender.py"
- "scripts/retired_files.py"
- "scripts/romset_recipes.py"
- "scripts/romdir.py"
- "scripts/sitesources.py"
- "scripts/sitesteps.py"
- "scripts/sitestarlight.py"
- "scripts/sitesteps.py"
- "scripts/sitewanted.py"
- "scripts/sitewrite.py"
- "scripts/slot.py"
- "scripts/slots.py"
- "scripts/sourceref.py"
- "scripts/split_pack.py"
- "scripts/torrentzip.py"
- "scripts/truth.py"
- "scripts/upstream.py"
- "scripts/validate_pr.py"
- "scripts/validate_schemas.py"
- "scripts/validate_site.py"
- "scripts/validation.py"
- "scripts/verify.py"
- "scripts/ziptools.py"
- "schemas/**"
- "docs_assets/**"
- "install/**"
+1 -1
View File
@@ -105,7 +105,7 @@ def ledger_text(records: dict[str, dict]) -> str:
def write_ledger(records: dict[str, dict], path: Path = ARCHIVES_FILE) -> bool:
from artifacts import write_if_changed
from core.artifacts import write_if_changed
path.parent.mkdir(parents=True, exist_ok=True)
return write_if_changed(str(path), ledger_text(records))
+1 -1
View File
@@ -86,7 +86,7 @@ def find_missing(config: dict, db: dict) -> list[dict]:
checks them inside the zip and holds them, and saw none of the files
the cores need that no platform lists.
"""
from nativemode import reads_file_contents
from resolve.nativemode import reads_file_contents
from verify import Status, verify_platform
result = verify_platform(config, db)
+1 -1
View File
@@ -548,7 +548,7 @@ def _hardlink_tree(src: Path, dst: Path) -> None:
def seed_worktree(repo: Path, worktree: Path) -> list[str]:
"""Hard-link what git does not carry: a tool deleting a file drops a link."""
from largefiles import load_registered_paths
from model.largefiles import load_registered_paths
seeded = []
for rel in [".cache/large", "data", *load_registered_paths(repo / ".gitignore")]:
+1 -1
View File
@@ -43,7 +43,7 @@ from dataclasses import dataclass, field
from pathlib import Path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from largefiles import load_registered_paths
from model.largefiles import load_registered_paths
MISREAD = "misread"
RESTORED = "restored"
+1 -1
View File
@@ -29,7 +29,7 @@ from collections.abc import Iterator
from dataclasses import dataclass, field
from pathlib import Path
from artifacts import write_text_atomic
from core.artifacts import write_text_atomic
ROOT = Path(__file__).resolve().parent.parent
PACKAGE = "installer"
+1 -1
View File
@@ -38,7 +38,7 @@ import sys
import zipfile
from pathlib import Path
from artifacts import ArtifactLockBusy, artifact_lock
from core.artifacts import ArtifactLockBusy, artifact_lock
REPO_ROOT = Path(__file__).resolve().parent.parent
PORT_DIR = "retrobios"
+1 -1
View File
@@ -1164,7 +1164,7 @@ class Campaign:
return result.record
def system_entries(self, profile: dict, system: str) -> list[tuple[int, dict]]:
from validation import filter_files_by_mode
from resolve.validation import filter_files_by_mode
libretro = filter_files_by_mode(profile.get("files") or [], standalone=False)
keep = {id(e) for e in libretro}
+1 -1
View File
@@ -66,7 +66,7 @@ from common import (
yaml_load,
)
from exporter import discover_exporters
from exporter.baseline import build_native_model
from resolve.reconcile import build_native_model
from scripts.scraper import game_dat_importer
from scripts.scraper.redump_dat_scraper import fetch_snapshot
from scripts.scraper.targets import discover_target_scrapers
+1 -1
View File
@@ -33,7 +33,7 @@ from pathlib import Path
sys.path.insert(0, os.path.dirname(__file__))
from check_release_assets import digests_of
from common import list_release_pack_platforms, require_directory
from largefiles import LARGE_FILES_REPO
from model.largefiles import LARGE_FILES_REPO
from release_record import RECORD, load_record
SUMS = "SHA256SUMS.txt"
+1 -6
View File
@@ -26,12 +26,7 @@ from typing import NamedTuple
sys.path.insert(0, os.path.dirname(__file__))
from common import composition_tier, load_database
from largefiles import (
LARGE_FILES_RELEASE,
LARGE_FILES_REPO,
asset_names,
registered_paths,
)
from model.largefiles import LARGE_FILES_RELEASE, LARGE_FILES_REPO, asset_names, registered_paths
class AssetFinding(NamedTuple):
+18 -18
View File
@@ -25,21 +25,21 @@ import zipfile
from pathlib import Path
from typing import TYPE_CHECKING, Any, TextIO, TypedDict
from alternatives import derive_member_requirements
from model.alternatives import derive_member_requirements
if TYPE_CHECKING:
from typing_extensions import Unpack
# Re-exported so the existing call sites keep working while the
# modules above become the place to import from.
from safeparse import (
from model.safeparse import (
parse_untrusted_xml as parse_untrusted_xml,
require_yaml as require_yaml,
yaml_load as yaml_load,
_pick_yaml_loader as _pick_yaml_loader,
_YAML_LOADER as _YAML_LOADER,
)
from hashing import (
from core.hashing import (
compute_hashes as compute_hashes,
md5sum as md5sum,
md5_composite as md5_composite,
@@ -48,7 +48,7 @@ from hashing import (
_ALL_ALGORITHMS as _ALL_ALGORITHMS,
_md5_composite_cache as _md5_composite_cache,
)
from ziptools import (
from core.ziptools import (
check_inside_zip as check_inside_zip,
build_zip_contents_index as build_zip_contents_index,
MAX_ZIP_MEMBERS as MAX_ZIP_MEMBERS,
@@ -61,7 +61,7 @@ from ziptools import (
zip_member_crcs as zip_member_crcs,
zip_member_names as zip_member_names,
)
from artifacts import (
from core.artifacts import (
write_if_changed as write_if_changed,
write_text_atomic as write_text_atomic,
copy_file_atomic as copy_file_atomic,
@@ -77,13 +77,13 @@ from artifacts import (
_TIMESTAMP_PATTERNS as _TIMESTAMP_PATTERNS,
_strip_timestamps as _strip_timestamps,
)
from largefiles import (
from model.largefiles import (
LARGE_FILES_RELEASE as LARGE_FILES_RELEASE,
LARGE_FILES_REPO as LARGE_FILES_REPO,
LARGE_FILES_CACHE as LARGE_FILES_CACHE,
fetch_large_file as fetch_large_file,
)
from dumpcatalog import (
from model.dumpcatalog import (
DEFAULT_PROVENANCE_DIR as DEFAULT_PROVENANCE_DIR,
load_provenance_snapshots as load_provenance_snapshots,
build_provenance_index as build_provenance_index,
@@ -402,7 +402,7 @@ def declared_content_checks(file_entry: dict) -> set[str]:
@functools.lru_cache(maxsize=4096)
def _romdir_verdict(path: str, size: int, mtime_ns: int, spec: str) -> bool:
from romdir import romdir_accepts
from core.romdir import romdir_accepts
with open(path, "rb") as f:
data = f.read()
@@ -1518,7 +1518,7 @@ def _required_met(members: list[dict], held: Callable[[dict], bool]) -> tuple[in
alternatives, met when one of its members is held: Odin reads the
first of three Hikaru boot ROMs it finds in hikaru.zip.
"""
from alternatives import groups_of
from model.alternatives import groups_of
met = 0
complete = True
@@ -3365,7 +3365,7 @@ def standalone_set(config: dict) -> set[str]:
for core in entry.get("cores") or []
}
if names - {n for n in names if n.startswith(CORE_DIR_PREFIX)}:
from launchers import executed_files, handed_directories
from resolve.launchers import executed_files, handed_directories
handed = handed_directories(config)
# The record's position travels too: a search list is read in order.
@@ -3385,7 +3385,7 @@ def standalone_set(config: dict) -> set[str]:
if f.get("name")
}
# The machines a record offers under its systems, by normalized id.
from launchers import native_systems
from resolve.launchers import native_systems
natives = native_systems(config)
names |= {
@@ -3421,7 +3421,7 @@ def merged_standalone_set(configs: Iterable[dict]) -> set[str]:
def _handed(standalone_cores: Iterable[str]) -> list:
"""The directories a standalone set carries, as launchers built them."""
from launchers import HandedDirectory
from resolve.launchers import HandedDirectory
found = []
for tag in standalone_cores:
@@ -3465,7 +3465,7 @@ def entry_launch_systems(entry: dict, index: Mapping[str, set[str]]) -> frozense
def _executed(standalone_cores: Iterable[str]) -> list:
"""The files a standalone set's launchers execute, as launchers read them."""
from launchers import ExecutedFile
from resolve.launchers import ExecutedFile
found = []
for tag in standalone_cores:
@@ -3560,7 +3560,7 @@ def standalone_destination(
layout = standalone_layout_path(entry, profile)
if layout is None or not bindings:
return None
from launchers import bound_path
from resolve.launchers import bound_path
return bound_path(layout, bindings)
@@ -3573,7 +3573,7 @@ def standalone_bindings_for(
``systems`` are those the entry is launched for (entry_launch_systems).
"""
from launchers import directory_handles, pool_folders, standalone_bindings
from resolve.launchers import directory_handles, pool_folders, standalone_bindings
declared = directory_handles(profile)
pools = pool_folders(profile)
@@ -3671,7 +3671,7 @@ class _StandaloneLaunches:
# The layout folders a search setting stands for (standalone_pools):
# bound, the launcher passes the setting and the default is not read.
from launchers import pool_folders as _pool_folders
from resolve.launchers import pool_folders as _pool_folders
pool_folders = {v.strip("/") for v in _pool_folders(profile).values()} - {""}
return cls(
@@ -3931,7 +3931,7 @@ def content_folder_tags(config: dict) -> set[str]:
boards = content_folder_boards(config)
target = config.get(TARGET_KEY)
pairs = {pair for pair, on in boards.items() if not target or on is None or target in on}
from launchers import _roms_place
from resolve.launchers import _roms_place
def place(folder: str) -> list:
return list(_roms_place(config, folder) or ())
@@ -4081,7 +4081,7 @@ def _libretro_content_layout(
# path with stand for these: libretro MAME hands MAME
# <system>/mame/bios unless the content's command line names
# another (retro_init.cpp Set_Path_Option, execute_game_cmd).
from launchers import pool_folders
from resolve.launchers import pool_folders
pools = set(pool_folders({"standalone_pools": view.get("libretro_pools")}).values())
out: list = []
+1
View File
@@ -0,0 +1 @@
"""Standard-library foundations: hashing, archives, parsing, artifacts, command-line plumbing."""
@@ -14,6 +14,7 @@ import os
import tempfile
import threading
import re
from core.paths import REPO_ROOT
_TIMESTAMP_PATTERNS = [
@@ -259,7 +260,7 @@ def artifact_lock(directory: str, exclusive: bool = True) -> Iterator[None]:
# refused because another module holds it. Nothing else sets it.
moved = os.environ.get(REPOSITORY_LOCK_ENV)
real = os.path.realpath(directory)
if moved and os.path.isfile(os.path.join(real, "scripts", "artifacts.py")):
if moved and os.path.isfile(os.path.join(real, "scripts", "core", "artifacts.py")):
# Keyed by the root's path: a scratch checkout and the process it
# spawns name the same root, and find the same lock.
lock_dir = os.path.join(moved, real.strip(os.sep).replace(os.sep, "__"))
@@ -335,7 +336,7 @@ def hold_repository_outputs(root: str = ".") -> Iterator[None]:
yield
_REPO_ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
_REPO_ROOT = str(REPO_ROOT)
def repository_output_lock(path: str) -> contextlib.AbstractContextManager[None]:
@@ -375,7 +375,7 @@ def verify_otp(
Returns (valid, reason_string).
"""
from sect233r1 import _N, _ec_mul, _Gx, _Gy, ecdsa_verify_sha256
from core.sect233r1 import _N, _ec_mul, _Gx, _Gy, ecdsa_verify_sha256
data = bytearray(Path(filepath).read_bytes())
File renamed without changes.
File renamed without changes.
+8
View File
@@ -0,0 +1,8 @@
"""The repository root, and pack-relative destinations normalized the same way by every reader."""
from __future__ import annotations
from pathlib import Path
# The repository: scripts/core/ is two levels below it.
REPO_ROOT = Path(__file__).resolve().parents[2]
File renamed without changes.
File renamed without changes.
@@ -16,8 +16,9 @@ import sys
import tempfile
import zipfile
from artifacts import process_umask, set_plain_mode
from hashing import md5sum
from core.artifacts import process_umask, set_plain_mode
from core.hashing import md5sum
from core.paths import REPO_ROOT
def check_inside_zip(container: str, file_name: str, expected_md5: str) -> str:
@@ -114,7 +115,7 @@ _zip_contents_cache: tuple[tuple, dict] | None = None
# a cached answer is never stale. Every pipeline step that resolves a
# zipped_file used to decompress the 54 845 members again, about 23 s each.
MEMBER_CACHE = os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))), ".cache", "zip_member_md5.json"
REPO_ROOT, ".cache", "zip_member_md5.json"
)
+6 -6
View File
@@ -26,7 +26,7 @@ from pathlib import Path
from typing import TYPE_CHECKING, TypedDict
sys.path.insert(0, os.path.dirname(__file__))
from alternatives import set_keys, set_requirements, settle_sets
from model.alternatives import set_keys, set_requirements, settle_sets
from common import (
OUTER_ROOTS,
platform_arg,
@@ -56,8 +56,8 @@ from common import (
standalone_set,
select_emulator_profiles,
)
from hashing import parse_hash_list
from launchers import (
from core.hashing import parse_hash_list
from resolve.launchers import (
LauncherLayer,
bound_launchers,
catalogued_model_files,
@@ -69,9 +69,9 @@ from launchers import (
setting_readers,
suffixed_stem,
)
from launchers import _directories as launcher_directories
from launchers import _names as launcher_names
from validation import (
from resolve.launchers import _directories as launcher_directories
from resolve.launchers import _names as launcher_names
from resolve.validation import (
case_folded_slots,
declaration_settles,
inner_rom_check,
+1 -1
View File
@@ -26,7 +26,7 @@ from common import (
truth_target_dir,
yaml_load,
)
from truth import diff_platform_truth
from resolve.truth import diff_platform_truth
yaml = require_yaml()
+4 -4
View File
@@ -32,7 +32,7 @@ from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
from artifacts import file_lock, write_bytes_atomic, write_if_changed, write_text_atomic
from core.artifacts import file_lock, write_bytes_atomic, write_if_changed, write_text_atomic
import yaml
from common import (
@@ -51,7 +51,7 @@ from common import (
)
from exporter import discover_exporters
from exporter.base_exporter import BaseExporter
from exporter.baseline import (
from resolve.reconcile import (
HASH_FIELDS,
NativeFile,
Report,
@@ -59,9 +59,9 @@ from exporter.baseline import (
_single_size,
build_native_model,
)
from exporter.candidates import removal_candidates
from resolve.categories import removal_candidates
from exporter.doubled import doubled_destinations
from truth import generate_platform_truth
from resolve.truth import generate_platform_truth
DEFAULT_CACHE = ".cache/upstream-native"
# The database generate_truth reads by default.
+1 -1
View File
@@ -9,7 +9,7 @@ every build, and an addition is written the same way.
from __future__ import annotations
from .baseline import NativeFile
from resolve.reconcile import NativeFile
from .batocera_exporter import Exporter as BatoceraExporter
SOURCE_URL = (
+1 -1
View File
@@ -11,7 +11,7 @@ from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Generic, TypeVar, Union
from .baseline import NativeFile, NativeSystem, Report
from resolve.reconcile import NativeFile, NativeSystem, Report
# What a produced file holds: text for every format, bytes besides for one
# that also hands back an archive (MiSTer's bios_db.json.zip).
+1 -1
View File
@@ -12,7 +12,7 @@ import ast
import re
from .base_exporter import BaseExporter
from .baseline import NativeFile, NativeSystem, Report
from resolve.reconcile import NativeFile, NativeSystem, Report
SOURCE_URL = (
"https://raw.githubusercontent.com/batocera-linux/batocera.linux/master"
+1 -1
View File
@@ -10,7 +10,7 @@ file is served as BizHawk wrote it, checked for its structure.
from __future__ import annotations
from .base_exporter import BaseExporter
from .baseline import NativeFile, NativeSystem, Report
from resolve.reconcile import NativeFile, NativeSystem, Report
SOURCE_URL = (
"https://raw.githubusercontent.com/TASEmulators/BizHawk/master"
+2 -2
View File
@@ -22,9 +22,9 @@ from common import (
resolve_platform_cores,
standalone_set,
)
from exporter.baseline import HASH_FIELDS, _hash_values
from resolve.reconcile import HASH_FIELDS, _hash_values
from slots import _accepted_by_all, _lists_hashes, find_collisions
from validation import opens_by_name, outside_gap_scope
from resolve.validation import opens_by_name, outside_gap_scope
def _names(entry: dict) -> set[str]:
+1 -1
View File
@@ -18,7 +18,7 @@ sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from scraper.emudeck_scraper import FUNCTION_HASH_MAP, _RE_FUNC, _RE_LOCAL_HASHES
from .base_exporter import BaseExporter
from .baseline import NativeFile, NativeSystem, Report, _hash_values
from resolve.reconcile import NativeFile, NativeSystem, Report, _hash_values
SOURCE_URL = (
"https://raw.githubusercontent.com/dragoonDorise/EmuDeck/main"
+1 -1
View File
@@ -14,7 +14,7 @@ from collections import OrderedDict
from typing import Union
from .base_exporter import BaseExporter
from .baseline import NativeFile, NativeSystem, Report
from resolve.reconcile import NativeFile, NativeSystem, Report
SOURCE_URL = (
"https://raw.githubusercontent.com/ajgowans/BiosDB_MiSTer/db/bios_db.json.zip"
+1 -1
View File
@@ -23,7 +23,7 @@ sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from common import load_emulator_profiles, parse_untrusted_xml
from .base_exporter import BaseExporter
from .baseline import NativeFile, NativeSystem, Report, by_destination, by_name
from resolve.reconcile import NativeFile, NativeSystem, Report, by_destination, by_name
SOURCE_URL = (
"https://gitlab.com/recalbox/recalbox/-/raw/master/board/recalbox/fsoverlay"
+1 -1
View File
@@ -11,7 +11,7 @@ import re
from collections import OrderedDict
from .base_exporter import BaseExporter
from .baseline import NativeFile, NativeSystem, Report
from resolve.reconcile import NativeFile, NativeSystem, Report
SOURCE_URL = (
"https://raw.githubusercontent.com/RetroBat-Official/emulatorlauncher/master"
+1 -1
View File
@@ -13,7 +13,7 @@ import json
from collections import OrderedDict
from .base_exporter import BaseExporter
from .baseline import NativeFile, NativeSystem, Report
from resolve.reconcile import NativeFile, NativeSystem, Report
COMPONENTS_REPO = "RetroDECK/components"
COMPONENTS_BRANCH = "main"
+1 -1
View File
@@ -24,7 +24,7 @@ sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from common import load_emulator_profiles
from .base_exporter import BaseExporter
from .baseline import NativeFile, NativeSystem, Report, search_order
from resolve.reconcile import NativeFile, NativeSystem, Report, search_order
SOURCE_URL = (
"https://codeload.github.com/RetroPie/RetroPie-Setup/tar.gz/refs/heads/master"
+1 -1
View File
@@ -8,7 +8,7 @@ from __future__ import annotations
import re
from .baseline import NativeSystem, Report
from resolve.reconcile import NativeSystem, Report
from .batocera_exporter import Exporter as BatoceraExporter
SOURCE_URL = (
+1 -1
View File
@@ -18,7 +18,7 @@ sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from scraper.romm_scraper import SLUG_MAP
from .base_exporter import BaseExporter
from .baseline import NativeFile, NativeSystem, Report, _hash_values
from resolve.reconcile import NativeFile, NativeSystem, Report, _hash_values
SOURCE_URL = (
"https://raw.githubusercontent.com/rommapp/romm/master/backend/models"
+1 -1
View File
@@ -16,7 +16,7 @@ sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from scraper.dat_parser import parse_dat
from .base_exporter import BaseExporter
from .baseline import NativeFile, NativeSystem, Report
from resolve.reconcile import NativeFile, NativeSystem, Report
SOURCE_URL = (
"https://raw.githubusercontent.com/libretro/libretro-database/master/dat/System.dat"
+1 -1
View File
@@ -27,7 +27,7 @@ sys.path.insert(0, os.path.dirname(__file__))
import upstream
from common import require_directory, suggest_names
from profile_sync import collect_citations, ref_role, select_views, split_source_ref
from safeparse import yaml_load
from model.safeparse import yaml_load
# Ways a program asks for somewhere to read from.
SIGNALS = (
+1 -1
View File
@@ -21,7 +21,7 @@ from pathlib import Path
from common import load_emulator_profiles
from region import REGIONS, normalize_declared
from safeparse import yaml_load
from model.safeparse import yaml_load
REGIONS_FILE = Path("games") / "regions.yml"
EXTRAS_FILE = Path("games") / "extras.yml"
+1 -1
View File
@@ -386,7 +386,7 @@ def save_cache(cache_path: str, cache: dict) -> None:
def _load_gitignored_large_files() -> set[str]:
"""The bios/ paths .gitignore registers as release assets."""
from largefiles import load_registered_paths
from model.largefiles import load_registered_paths
return set(load_registered_paths(".gitignore"))
+1 -1
View File
@@ -13,7 +13,7 @@ import json
import sys
from pathlib import Path
from artifacts import write_text_atomic
from core.artifacts import write_text_atomic
ROOT = Path(__file__).resolve().parent.parent
OUTPUT = ROOT / "schemas" / "install-events.schema.json"
+2 -2
View File
@@ -58,8 +58,8 @@ from romfolders import (
folder_names,
load_setups,
)
from artifacts import write_text_atomic
from safeparse import yaml_load
from core.artifacts import write_text_atomic
from model.safeparse import yaml_load
import install
+1 -1
View File
@@ -48,7 +48,7 @@ from pathlib import Path, PurePosixPath
from typing import TYPE_CHECKING, Any, Callable
import sitehandheld
from artifacts import write_text_atomic
from core.artifacts import write_text_atomic
if TYPE_CHECKING:
from install import LocalCopy, Progress, _OsRule
+1 -1
View File
@@ -22,7 +22,7 @@ import json
import sys
from pathlib import Path
from artifacts import write_text_atomic
from core.artifacts import write_text_atomic
from build_port import (
BATOCERA_ZIP,
MUOS_APP,
+14 -12
View File
@@ -21,7 +21,7 @@ if sys.version_info < (3, 9):
from collections.abc import Callable, Iterable, Iterator, Mapping
from artifacts import _build_timestamp, set_plain_mode
from core.artifacts import _build_timestamp, set_plain_mode
import argparse
import contextlib
import functools
@@ -38,7 +38,7 @@ from dataclasses import dataclass, field
from typing import TYPE_CHECKING, TypedDict
sys.path.insert(0, os.path.dirname(__file__))
from alternatives import core_file_spares, settle_sets, slot_set_keys
from model.alternatives import core_file_spares, settle_sets, slot_set_keys
from common import resolve_platform_cores as _platform_cores
from common import (
ROMS_ROOT,
@@ -109,18 +109,20 @@ import packresolve
from refresh_data_dirs import cache_lock, hold_data_dirs
import region as region_mod
from manifestselect import SelectionIndex
import slot as slot_mod
from resolve import slot as slot_mod
import slots
import split_pack
from gamedata import GAME_DATA, GameDataCut, is_game_data, platform_game_data, without_game_data
from deterministic_zip import _FIXED_DATE_TIME
from largefiles import asset_name, load_registered_paths, published_asset_name
from nativemode import (
digest_algorithm,
hash_mismatch_excludes_file,
reads_file_contents,
from resolve.gamedata import (
GAME_DATA,
GameDataCut,
is_game_data,
platform_game_data,
without_game_data,
)
from validation import (
from core.deterministic_zip import _FIXED_DATE_TIME
from model.largefiles import asset_name, load_registered_paths, published_asset_name
from resolve.nativemode import digest_algorithm, hash_mismatch_excludes_file, reads_file_contents
from resolve.validation import (
baseline_verdict,
existence_discrepancy,
destination_owners,
@@ -6373,7 +6375,7 @@ def _offered_boards(
pairs = content_folder_boards(config)
if all(on is None for on in pairs.values()):
return {}
from launchers import _roms_place
from resolve.launchers import _roms_place
by_key: dict[str, set[str]] = {}
for name, claimants in upstream_profile_index(profiles).items():
+1 -1
View File
@@ -42,7 +42,7 @@ import archive_build
import release_record
from siteguides import PACKAGE_COMMAND, install_command
from validate_pr import LARGE_FILE_ISSUE_URL
from largefiles import LARGE_FILES_CACHE, load_registered_paths
from model.largefiles import LARGE_FILES_CACHE, load_registered_paths
import pr_checks
from verify import verify_platform
+1 -1
View File
@@ -22,7 +22,7 @@ import subprocess
import sys
from pathlib import Path
from artifacts import write_text_atomic
from core.artifacts import write_text_atomic
ROOT = Path(__file__).resolve().parent.parent
PAGE = ROOT / "wiki" / "reading-reports.md"
+16 -16
View File
@@ -72,10 +72,10 @@ from common import (
yaml_load,
)
from siterender import SECTION_LABELS, WIKI_SRC_DIR
from artifacts import ArtifactLockBusy, artifact_lock
from artifacts import json_text as _json_text
from core.artifacts import ArtifactLockBusy, artifact_lock
from core.artifacts import json_text as _json_text
from cross_reference import FileConsumers, entry_target, held_copy
from nativemode import check_label, digest_algorithm, reads_file_contents
from resolve.nativemode import check_label, digest_algorithm, reads_file_contents
from generate_readme import (
platform_coverages,
@@ -1256,7 +1256,7 @@ def build_emulator_gap_report(
if v.get("type") != "alias" and v.get("role") != "test"
}
from common import merged_standalone_set, platform_declarations
from validation import case_folded_slots
from resolve.validation import case_folded_slots
# The command line passes these too: without them a RetroBat file named
# 32X_G_BIOS.BIN read as missing for a core opening 32X_G_BIOS.bin.
@@ -3724,8 +3724,8 @@ def _served_line(f: dict, declared_sha1: str = "") -> str:
def _launcher_refs(config: dict) -> dict[str, list[str]]:
"""Entry name, casefolded -> each launcher record that opens it, rendered."""
from launchers import _names as launcher_names
from launchers import bound_launchers
from resolve.launchers import _names as launcher_names
from resolve.launchers import bound_launchers
from sitesources import launcher_ref_markdown, list_source
# Every scraper reads its launchers in the repository and at the revision
@@ -3754,7 +3754,7 @@ def _launcher_unproven_section(config: dict) -> list[str]:
A config file is proof only when the code installing it and the code
reading it are shown: these records place no file.
"""
from launchers import launcher_unproven
from resolve.launchers import launcher_unproven
from sitesources import launcher_ref_markdown, list_source
rows = launcher_unproven({str(config.get("_key") or ""): config})
@@ -3800,7 +3800,7 @@ def _copy_hash(algorithm: str, value: str | list) -> str:
"""A declared hash cut to SHORT_HASH characters on a button that copies
it whole. A list of accepted values (Recalbox) copies its first. Outside
a form a button submits nothing, so it carries no type."""
from hashing import parse_hash_list
from core.hashing import parse_hash_list
values = parse_hash_list(value)
if not values:
@@ -5170,7 +5170,7 @@ def _data_member_digests(
The manifests carry sha1 alone: the MD5 of Dolphin's ApprovedInis.json
found nothing although the pack ships it."""
from common import load_data_dir_registry
from hashing import compute_hashes
from core.hashing import compute_hashes
if data_registry is None:
data_registry = load_data_dir_registry(str(siteinputs.current().platforms))
@@ -5989,7 +5989,7 @@ def _fetch_url(path: str) -> str:
large-files release asset when .gitignore keeps it out of git."""
global _RELEASE_ASSET_NAMES
if _RELEASE_ASSET_NAMES is None:
from largefiles import (
from model.largefiles import (
LARGE_FILES_RELEASE,
asset_names,
load_registered_paths,
@@ -8396,7 +8396,7 @@ def comes_with_app(f: dict) -> bool:
narrowed by ``mode`` is that build's alone: the other build reads its
own entry, or nothing.
"""
from validation import installed_with_emulator
from resolve.validation import installed_with_emulator
return installed_with_emulator(f)
@@ -9020,7 +9020,7 @@ def _more_words(lines: list[str]) -> list[str]:
def _short_hash_line(f: dict) -> str:
"""The entry's strongest declared hash, cut to SHORT_HASH characters,
with a copy button for the whole value. "" when it declares none."""
from hashing import parse_hash_list
from core.hashing import parse_hash_list
for field, label in (("sha1", "SHA1"), ("md5", "MD5"), ("sha256", "SHA256"), ("crc32", "CRC32")):
values = parse_hash_list(f.get(field) or "")
@@ -9961,7 +9961,7 @@ def _hash_spans(value: str | list, copy: bool = False) -> str:
that only a profile declares were out of reach of the site search: it
indexes text, and a pasted sha1 matched nothing.
"""
from hashing import parse_hash_list
from core.hashing import parse_hash_list
return ", ".join(
markup.hash_value(v, copy) for v in parse_hash_list(value)
@@ -11072,7 +11072,7 @@ def _declared_hashes(config: dict, detail: dict) -> dict[str, list[str]]:
and named neither: the reader could not look for the dump RetroDECK asks
for, nor report the difference.
"""
from hashing import parse_hash_list
from core.hashing import parse_hash_list
system = (config.get("systems") or {}).get(detail.get("system", "")) or {}
for entry in system.get("files") or []:
@@ -11394,7 +11394,7 @@ def reading_platforms(emu_name: str, profile: dict, name: str,
build of it reads the entry: BlastEm's cdbios.bin is read by the
standalone build only, and RetroBat hands that build other names."""
from common import platform_layouts, standalone_set
from validation import filter_files_by_mode, unread_on
from resolve.validation import filter_files_by_mode, unread_on
return {
platform for platform, config in configs.items()
@@ -11507,7 +11507,7 @@ def _corroboration_rows(coverages: dict) -> list[str]:
def _divergence_rows(coverages: dict, registry: dict | None, profiles: dict, db: dict) -> list[str]:
"""Section 1b: platform lists vs emulator source, one row a platform."""
from truth import diff_platform_truth, generate_platform_truth
from resolve.truth import diff_platform_truth, generate_platform_truth
div_rows = []
for pname, cov in _by_platform_name(coverages):
+1 -1
View File
@@ -28,7 +28,7 @@ from common import (
write_text_atomic,
yaml_load,
)
from truth import generate_platform_truth
from resolve.truth import generate_platform_truth
yaml = require_yaml()
+1 -1
View File
@@ -28,7 +28,7 @@ sys.path.insert(0, os.path.dirname(__file__))
import upstream
from common import require_directory
from safeparse import yaml_load
from model.safeparse import yaml_load
from scraper.mame_parser import _MACHINE_MACROS, strip_comments
# An optional role word names the repository the lines are in.
+1 -1
View File
@@ -18,7 +18,7 @@ from __future__ import annotations
from dataclasses import dataclass
import region as region_mod
import slot as slot_mod
from resolve import slot as slot_mod
from common import _norm_system_id, sanitize_pack_path
from packextras import (
_kept,
+1
View File
@@ -0,0 +1 @@
"""Data loading: database, platforms and registry, profiles, targets, systems, catalogues."""
File renamed without changes.
@@ -8,7 +8,7 @@ from __future__ import annotations
import json
from pathlib import Path
from artifacts import write_if_changed
from core.artifacts import write_if_changed
DEFAULT_PROVENANCE_DIR = "provenance"
@@ -20,8 +20,9 @@ from collections import Counter
from collections.abc import Iterable
from pathlib import Path
from artifacts import set_plain_mode
from hashing import compute_hashes
from core.artifacts import set_plain_mode
from core.hashing import compute_hashes
from core.paths import REPO_ROOT
LARGE_FILES_RELEASE = "large-files"
@@ -34,7 +35,7 @@ LARGE_FILES_CACHE = ".cache/large"
# last: callers read the extension (an archive is packed as one).
VERIFIED_STORE = ".by-sha1"
ORPHAN_GRACE = 24 * 3600
GITIGNORE = Path(__file__).resolve().parent.parent / ".gitignore"
GITIGNORE = REPO_ROOT / ".gitignore"
_UNSAFE_ASSET_CHARS = re.compile(r"[^A-Za-z0-9._-]+")
File renamed without changes.
+2 -2
View File
@@ -73,8 +73,8 @@ from common import (
run_cli,
runs_standalone,
)
from validation import filter_files_by_mode
from ziptools import safe_extract_zip
from resolve.validation import filter_files_by_mode
from core.ziptools import safe_extract_zip
ROOT = Path(__file__).resolve().parent.parent
MAIN = autorun.main_checkout()
+9 -9
View File
@@ -11,7 +11,7 @@ from dataclasses import dataclass, field
from typing import TYPE_CHECKING, TypedDict
from common import PROFILE_IDENTITY_FIELDS, _norm_system_id, entry_system_ids
from alternatives import core_file_spares, required_only_spares, set_fields
from model.alternatives import core_file_spares, required_only_spares, set_fields
from common import archive_members, contents_members, holds_required_members
from common import declared_root, expand_platform_declared_names, platform_declarations
from common import load_emulator_profiles
@@ -22,7 +22,7 @@ from common import core_system_dirs, platform_layouts, system_dir_path
from common import standalone_set as platform_standalone_set
from common import OUTER_ROOTS, outer_layout, sanitize_pack_path
from common import declares_shape, shape_fits, size_fits
from validation import deliverable, read_from_save_dir, read_from_system_dir
from resolve.validation import deliverable, read_from_save_dir, read_from_system_dir
from packpaths import libretro_systems, save_destination, save_layout
from region import FILE_GROUP
@@ -260,7 +260,7 @@ def native_slug_systems(config: dict) -> set[str]:
def _file_sha1(path: str) -> str | None:
"""sha1 of a copy the database does not index, a data tree's file."""
from hashing import compute_hashes
from core.hashing import compute_hashes
try:
return compute_hashes(path, frozenset({"sha1"}))["sha1"]
@@ -314,7 +314,7 @@ class ExtraResolver:
def alternatives(self, fe: dict) -> list[dict]:
"""The versions the extra's own profile accepts at its slot, as
validation.extra_alternatives finds them."""
from validation import slot_index
from resolve.validation import slot_index
key = fe.get("source_profile") or ""
index = self._slots.get(key)
@@ -327,7 +327,7 @@ class ExtraResolver:
def resolve(self, fe: dict, dest: str) -> tuple[str | None, str, str]:
"""(local copy or None, resolver status, the core's disagreement)."""
from packresolve import pending_release_asset, resolve_file, run_is_offline
from validation import core_size_refusal, validated_choice
from resolve.validation import core_size_refusal, validated_choice
local_path, status = resolve_file(
fe, self.db, self.bios_dir, self.zip_contents,
@@ -2121,7 +2121,7 @@ def _ships(
AmberELEC's bluemsx config.ini read as missing while the pack held it.
"""
from packresolve import resolve_declaration
from validation import baseline_verdict
from resolve.validation import baseline_verdict
path, status = resolve_declaration(
file_entry, db, "bios", zip_contents, data_registry, override, offline=True,
@@ -2320,7 +2320,7 @@ def emulator_region_drops(
"""
import region as region_mod
from packpaths import _resolve_destination
from validation import _build_validation_index, filter_files_by_mode
from resolve.validation import _build_validation_index, filter_files_by_mode
region_index = region_mod.build_region_index(dict(selected))
region_groups: dict[str, list[tuple[str, str]]] = {}
@@ -2365,7 +2365,7 @@ def emulator_required_spares(
those the pack still carries after the region filter. An archive unit
is a member like a loose file: Kronos reads kronos/stvbios.zip, else
stvbios.zip. The pack and verify --emulator both read this."""
from alternatives import groups_of, rank_in, required_groups
from model.alternatives import groups_of, rank_in, required_groups
from common import archive_entry
from packpaths import _archive_destination, _resolve_destination
@@ -2413,7 +2413,7 @@ def _emulator_ships(
held it.
"""
from packresolve import resolve_file
from validation import validated_choice, with_archive_members
from resolve.validation import validated_choice, with_archive_members
local, status = resolve_file(
{**with_archive_members(file_entry, profile.get("files", [])),
+1 -1
View File
@@ -10,7 +10,7 @@ from collections.abc import Iterable
from dataclasses import dataclass
from common import sanitize_pack_path
from validation import read_from_save_dir
from resolve.validation import read_from_save_dir
@dataclass(frozen=True)
+4 -4
View File
@@ -13,15 +13,15 @@ import urllib.error
import urllib.request
from pathlib import Path
from largefiles import fetch_large_file
from hashing import cut_md5_owner
from model.largefiles import fetch_large_file
from core.hashing import cut_md5_owner
from common import (
declared_hash_verdict,
resolution_is_hash_exact,
resolve_local_file,
sanitize_pack_path,
)
from validation import inner_rom_check
from resolve.validation import inner_rom_check
# CLI-wide network policy. Public helpers can override it explicitly, while
# every CLI mode inherits --offline (including large-file release fallback).
_OFFLINE = False
@@ -173,7 +173,7 @@ def pending_release_asset(
asset the cache lacks was reported missing while an online build packed
it. ``registered`` is the .gitignore registry (load_registered_paths).
"""
from largefiles import asset_candidates, asset_names, load_registered_paths
from model.largefiles import asset_candidates, asset_names, load_registered_paths
name = file_entry.get("name", "")
if not name or name.endswith("/") or file_entry.get("type") == "directory":
+11 -11
View File
@@ -11,31 +11,31 @@ from dataclasses import dataclass, field
from typing import TYPE_CHECKING, TypedDict
from auto_fetch import DEFAULT_BIOS_DIR
from artifacts import _build_timestamp
from core.artifacts import _build_timestamp
from packpaths import MEDIA_MARKER, _has_path_conflict
from ziptools import build_zip_contents_index
from ziptools import check_inside_zip
from nativemode import digest_algorithm
from validation import baseline_verdict, digest_verdict
from nativemode import hash_mismatch_excludes_file
from core.ziptools import build_zip_contents_index
from core.ziptools import check_inside_zip
from resolve.nativemode import digest_algorithm
from resolve.validation import baseline_verdict, digest_verdict
from resolve.nativemode import hash_mismatch_excludes_file
import functools
import hashlib
import zlib
import sys
from common import filter_systems_by_target
from hashing import md5_composite_of, parse_md5_list
from core.hashing import md5_composite_of, parse_md5_list
import io
from common import load_emulator_profiles
from common import load_platform_config
import os
from packextras import platform_region_groups
from packpaths import _flat
from nativemode import reads_file_contents
from resolve.nativemode import reads_file_contents
import region as region_mod
import slots
from packresolve import resolve_declaration, resolve_file
from exporter.candidates import BIOS, EntryCategories
from gamedata import without_game_data
from resolve.categories import BIOS, EntryCategories
from resolve.gamedata import without_game_data
from common import resolve_platform_cores
from common import sanitize_pack_path
import zipfile
@@ -616,7 +616,7 @@ def _builder_extras(
there: taken by the refused file, that core file was never compared.
"""
from packextras import ExtraResolver, hidden_extras
from validation import _build_validation_index, destination_owners
from resolve.validation import _build_validation_index, destination_owners
config, emu_profiles = expect.config, expect.emu_profiles
data_registry = expect.opts.data_registry
+1 -1
View File
@@ -44,7 +44,7 @@ from common import (
suggest_names,
system_index,
)
from hashing import parse_hash_list
from core.hashing import parse_hash_list
from sourceref import ( # re-exported for callers and tests
_ANNOTATION_RE as _ANNOTATION_RE,
_BARE_RANGE_RE as _BARE_RANGE_RE,
+1 -1
View File
@@ -26,7 +26,7 @@ import urllib.request
import zipfile
from collections.abc import Callable, Iterator
from pathlib import Path
from artifacts import file_lock as _file_lock, set_plain_mode
from core.artifacts import file_lock as _file_lock, set_plain_mode
from common import InputMissing, github_token, platform_arg, require_platform, suggest_names, yaml_load
try:
+1 -1
View File
@@ -276,7 +276,7 @@ def nightly_core(core: str) -> tuple[Path, str]:
def pack_files(emulator: str, region: str, work: Path) -> dict[str, Path]:
"""The files generate_pack puts in the emulator's pack for one region,
extracted, by their path in the pack."""
from ziptools import safe_extract_zip
from core.ziptools import safe_extract_zip
out_dir = work / "pack"
subprocess.run([sys.executable, str(ROOT / "scripts" / "generate_pack.py"), "--emulator", emulator,
+1
View File
@@ -0,0 +1 @@
"""From declarations to files: content checks, resolution, layouts, cores, truth."""
@@ -11,16 +11,14 @@ the platform names that no profile describes leaves the verdict open.
from __future__ import annotations
import sys
from collections.abc import Iterable
from dataclasses import dataclass, field
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from common import _norm_system_id, resolve_platform_cores, unresolved_platform_cores
from exporter.baseline import HASH_FIELDS, NativeSystem, _hash_values
from launchers import _names as launcher_names
from resolve.reconcile import HASH_FIELDS, NativeSystem, _hash_values
from resolve.launchers import _names as launcher_names
def _tails(path: str) -> list[str]:
@@ -16,7 +16,7 @@ from __future__ import annotations
from dataclasses import dataclass
from common import resolve_platform_cores
from exporter.candidates import GAME_DATA, EntryCategories
from resolve.categories import GAME_DATA, EntryCategories
@dataclass(frozen=True)
@@ -21,6 +21,7 @@ from collections.abc import Callable, Iterable, Mapping
from dataclasses import dataclass
from common import declared_root, name_match_size_ok, resolve_local_file, sanitize_pack_path
from core.paths import REPO_ROOT
# The kinds whose names say which file the launcher opens. A link of a named
# file is one too: ROCKNIX links /storage/roms/bios/nds_bios_arm9.bin into
@@ -507,12 +508,11 @@ def _profiles_or_repo(profiles: Mapping[str, dict] | None) -> Mapping[str, dict]
if profiles is not None:
return profiles
if _DEFAULT_PROFILES is None:
from pathlib import Path
from common import load_emulator_profiles
_DEFAULT_PROFILES = load_emulator_profiles(
str(Path(__file__).resolve().parent.parent / "emulators")
str(REPO_ROOT / "emulators")
)
return _DEFAULT_PROFILES
File renamed without changes.
@@ -13,14 +13,12 @@ grouping is rebuilt from the per-file native_system the scrapers record.
from __future__ import annotations
import sys
from collections.abc import Callable
from dataclasses import dataclass, field
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from common import _norm_system_id
from core.paths import REPO_ROOT
HASH_FIELDS = ("sha1", "md5", "sha256", "crc32")
@@ -778,7 +776,7 @@ def _attach_runners(systems: dict[str, NativeSystem], scraped: dict | None) -> N
declared = scraped.get("cores")
libretro = {str(c) for c in declared} if isinstance(declared, list) else set()
standalone = {str(c) for c in scraped.get("standalone_cores") or []}
profiles = load_emulator_profiles(str(Path(__file__).resolve().parents[2] / "emulators"))
profiles = load_emulator_profiles(str(REPO_ROOT / "emulators"))
for system in systems.values():
for fe in system.files:
if fe.platform is not None or not fe.truth:
+1 -1
View File
@@ -29,7 +29,7 @@ rank: the second core reads it by its own rule, which no rank expresses.
from __future__ import annotations
from alternatives import set_keys
from model.alternatives import set_keys
BIOS_CATEGORY = "bios"
@@ -10,7 +10,6 @@ import copy
import os
import sys
from dataclasses import dataclass
from pathlib import Path
from common import (
OUTER_ROOTS,
@@ -20,15 +19,16 @@ from common import (
resolve_platform_cores,
standalone_set as platform_standalone_set,
)
from alternatives import groups_of
from hashing import compute_hashes
from validation import (
from model.alternatives import groups_of
from core.hashing import compute_hashes
from resolve.validation import (
filter_files_by_mode,
installed_with_emulator,
opens_by_name,
read_from_system_dir,
unread_on,
)
from core.paths import REPO_ROOT
_CONFLICTS_SHOWN: set[tuple[str, ...]] = set()
@@ -571,7 +571,7 @@ def _declaration_verdict(entry: dict, declaration: dict, db: dict | None) -> str
return "undecided"
_REPO_PLATFORMS = Path(__file__).resolve().parent.parent / "platforms"
_REPO_PLATFORMS = REPO_ROOT / "platforms"
def _fold_data_directory_readers(
@@ -942,7 +942,7 @@ def _hash_mismatch(t_entry: dict, s_entry: dict) -> dict | None:
contradicts nothing (checked_hashes), and a platform md5 that is a
composite of a zip's members is no container md5 (comparable).
"""
from exporter.baseline import contradicted_hashes
from resolve.reconcile import contradicted_hashes
fields = contradicted_hashes(t_entry, s_entry)
if not fields:
@@ -965,7 +965,7 @@ def _diff_system(truth_sys: dict, scraped_sys: dict) -> dict:
correct while the export corrected hashes the diff never named. An entry
never answers for two.
"""
from exporter.baseline import _is_placeholder, is_label, pair_entries, platform_declares
from resolve.reconcile import _is_placeholder, is_label, pair_entries, platform_declares
truth_files = [
fe for fe in truth_sys.get("files", [])
@@ -25,9 +25,9 @@ from common import (
sanitize_pack_path,
shape_fits,
)
from hashing import md5_composite, parse_hash_list, parse_md5_list
from nativemode import SIZE_AND_ANY_HASH, digest_algorithm, hash_mismatch_excludes_file
from ziptools import check_inside_zip
from core.hashing import md5_composite, parse_hash_list, parse_md5_list
from resolve.nativemode import SIZE_AND_ANY_HASH, digest_algorithm, hash_mismatch_excludes_file
from core.ziptools import check_inside_zip
if TYPE_CHECKING:
from typing_extensions import Unpack
@@ -169,7 +169,7 @@ def _rule_failure(
if check not in skip and not content_fits({"validation": [check], check: spec}, local_path):
return _CONTENT_REASONS[check]
if rule["crypto"] - skip:
from crypto_verify import check_crypto_validation
from core.crypto_verify import check_crypto_validation
return check_crypto_validation(local_path, filename, bios_dir)
return None
@@ -539,7 +539,7 @@ def check_file_validation(
# Signature/crypto checks (3DS RSA, AES)
if entry["crypto_only"]:
from crypto_verify import check_crypto_validation
from core.crypto_verify import check_crypto_validation
crypto_reason = check_crypto_validation(local_path, filename, bios_dir)
if crypto_reason:
+1 -1
View File
@@ -24,7 +24,7 @@ import sys
import tempfile
sys.path.insert(0, os.path.dirname(__file__))
from artifacts import set_plain_mode
from core.artifacts import set_plain_mode
from common import copy_file_atomic, load_database
+1 -1
View File
@@ -25,7 +25,7 @@ from common import (
preferred_profile,
upstream_profile_index,
)
from safeparse import yaml_load
from model.safeparse import yaml_load
ROMFOLDERS_DIR = Path("platforms") / "romfolders"
SOURCES_DIR = ROMFOLDERS_DIR / "_sources"
+1 -1
View File
@@ -210,7 +210,7 @@ class AtomPool:
"""Write the digest cache back, when this run learned anything."""
if self._digest_cache is None or not self._digests_changed:
return
from artifacts import write_text_atomic
from core.artifacts import write_text_atomic
self._digest_cache.parent.mkdir(parents=True, exist_ok=True)
write_text_atomic(
+1 -1
View File
@@ -50,7 +50,7 @@ from dataclasses import dataclass, field
from pathlib import Path
from typing import IO
from ..artifacts import write_if_changed
from core.artifacts import write_if_changed
from ..common import load_emulator_profiles, run_cli
from .romset_dat_importer import (
LISTXML_CHUNK,
+2 -2
View File
@@ -19,8 +19,8 @@ from pathlib import Path
from common import load_target_config, yaml_load
from hashing import cut_md5_owner
from safeparse import yaml_load_upstream
from core.hashing import cut_md5_owner
from model.safeparse import yaml_load_upstream
from .base_scraper import (
BaseScraper,
+1 -1
View File
@@ -31,7 +31,7 @@ import shlex
import urllib.error
import urllib.request
from safeparse import yaml_load_upstream
from model.safeparse import yaml_load_upstream
from .base_scraper import BaseScraper, BiosRequirement, fetch_github_latest_version
from .batocera_scraper import (
+1 -1
View File
@@ -14,7 +14,7 @@ from __future__ import annotations
import json
from collections.abc import Iterable, Mapping
from safeparse import parse_untrusted_xml
from model.safeparse import parse_untrusted_xml
# system -> [(emulator, [core, ...]), ...], both in the list's order.
SystemEmulators = dict[str, list[tuple[str, list[str]]]]
+1 -1
View File
@@ -39,7 +39,7 @@ from pathlib import Path
if (_SCRIPTS_DIR := str(Path(__file__).resolve().parents[1])) not in sys.path:
sys.path.insert(0, _SCRIPTS_DIR)
from artifacts import copy_stream_atomic, write_if_changed, write_text_atomic
from core.artifacts import copy_stream_atomic, write_if_changed, write_text_atomic
from common import parse_untrusted_xml
from region import REGIONS, WORLD
from region_audit import NOINTRO
+1 -1
View File
@@ -24,7 +24,7 @@ if (_SCRIPTS_DIR := str(Path(__file__).resolve().parents[2])) not in sys.path:
sys.path.insert(0, _SCRIPTS_DIR)
import upstream
from safeparse import yaml_load
from model.safeparse import yaml_load
CACHE_DIR = upstream.CACHE_DIR
+1 -1
View File
@@ -15,7 +15,7 @@ import yaml
from . import Fetcher, SourceError, load_sources, scrape_setup
from upstream import UpstreamError
from artifacts import write_text_atomic
from core.artifacts import write_text_atomic
from ..base_scraper import _PlatformDumper
DEFAULT_DIR = Path("platforms") / "romfolders"
+1 -1
View File
@@ -31,7 +31,7 @@ import shlex
from collections import Counter
from collections.abc import Iterator
from safeparse import parse_untrusted_xml, yaml_load_upstream
from model.safeparse import parse_untrusted_xml, yaml_load_upstream
from . import Fetcher, SourceError, register
+1 -1
View File
@@ -51,7 +51,7 @@ from ..common import (
load_platform_config,
run_cli,
)
from ..dumpcatalog import build_snapshot, load_provenance_snapshots, write_snapshot
from model.dumpcatalog import build_snapshot, load_provenance_snapshots, write_snapshot
from .logiqx_parser import LogiqxDat, parse_logiqx
MAX_MEMBER_SIZE = 200 * 1024 * 1024
@@ -27,7 +27,7 @@ from datetime import datetime, timezone
import yaml
from safeparse import yaml_load_upstream
from model.safeparse import yaml_load_upstream
from . import BaseTargetScraper
from ..base_scraper import github_headers
+1 -1
View File
@@ -21,7 +21,7 @@ import re
import subprocess
from pathlib import Path
from artifacts import write_if_changed
from core.artifacts import write_if_changed
REPO_RAW = "https://raw.githubusercontent.com/Abdess/retrobios"
SH_NAME = "i"
+1 -1
View File
@@ -17,7 +17,7 @@ from dataclasses import dataclass, fields
from pathlib import Path
import sitemarkup as markup
from safeparse import require_yaml
from model.safeparse import require_yaml
from sitebootstrap import PS1_NAME, SH_NAME
PLATFORMS_DIR = Path(__file__).resolve().parent.parent / "platforms"
+1 -1
View File
@@ -22,7 +22,7 @@ from dataclasses import dataclass, field
from pathlib import Path
import sitemarkup as markup
from artifacts import write_bytes_atomic
from core.artifacts import write_bytes_atomic
from build_port import ARCHIVES, BATOCERA_ZIP, MUOS_APP, PORT_ZIP, TOOLS_ZIP, build_archive
REPO_ROOT = Path(__file__).resolve().parent.parent
+1 -1
View File
@@ -33,7 +33,7 @@ from pathlib import Path
import measurement_records as mr
import sitemarkup as markup
from artifacts import json_text, write_if_changed
from core.artifacts import json_text, write_if_changed
from siterender import _escape_tags
ROOT = Path(__file__).resolve().parent.parent
+1 -1
View File
@@ -447,7 +447,7 @@ def _read_arcade_source() -> tuple[dict, dict] | None:
def _entry_archives(entry: dict, files: dict, by_name: dict) -> set[str]:
"""The archives of the collection a ``bios_zip`` entry names."""
from ziptools import zip_member_crcs
from core.ziptools import zip_member_crcs
crcs = {
str(member["crc32"]).lower()
+2 -2
View File
@@ -24,9 +24,9 @@ from pathlib import Path
import archive_build
from common import runs_standalone, unique_emulator_profiles
from cross_reference import _first_hash
from hashing import cut_md5_owner, parse_hash_list
from core.hashing import cut_md5_owner, parse_hash_list
from validate_pr import LARGE_FILE_ISSUE_URL, Placement, placement
from validation import deliverable, filter_files_by_mode, installed_with_emulator
from resolve.validation import deliverable, filter_files_by_mode, installed_with_emulator
ALGORITHMS = ("sha1", "sha256", "md5", "crc32")
# GitHub's upload page takes 25 MB per file. A larger file goes in by a
+1 -1
View File
@@ -8,7 +8,7 @@ the clock alone."""
from __future__ import annotations
from pathlib import Path
from artifacts import write_if_changed as _write_artifact
from core.artifacts import write_if_changed as _write_artifact
import os
# Every path this run produced. The generated directories used to be deleted
# before the build, which made every page new: write_if_changed had no earlier
+2 -2
View File
@@ -24,7 +24,7 @@ import zlib
from dataclasses import dataclass, field
from typing import TYPE_CHECKING
import nativemode
from resolve import nativemode
from common import (
compute_hashes,
platform_arg,
@@ -44,7 +44,7 @@ from common import (
variant_base_name,
)
from packresolve import preferred_entries
from validation import (
from resolve.validation import (
content_alternatives,
outside_gap_scope,
read_from_save_dir,
+1 -1
View File
@@ -28,7 +28,7 @@ import zipfile
import zlib
from pathlib import Path
from artifacts import ArtifactLockBusy, artifact_lock
from core.artifacts import ArtifactLockBusy, artifact_lock
# "Each file included in a release must be under 2 GiB."
ASSET_LIMIT = 2 * 1024**3
+1 -6
View File
@@ -36,12 +36,7 @@ from pathlib import Path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from check_release_assets import compare, expected_assets, expected_digests, fetch_release
from common import load_database
from largefiles import (
LARGE_FILES_RELEASE,
LARGE_FILES_REPO,
asset_names,
registered_paths,
)
from model.largefiles import LARGE_FILES_RELEASE, LARGE_FILES_REPO, asset_names, registered_paths
STAGING = Path("tmp") / "sync_release_assets"
OUT_OF_DATE = ("missing", "size", "content")
+1 -1
View File
@@ -25,7 +25,7 @@ from dataclasses import dataclass
from datetime import datetime
from pathlib import Path
from artifacts import set_plain_mode
from core.artifacts import set_plain_mode
USER_AGENT = "retrobios-profile-sync/1.0"
# Where fetched upstream files live, shared by every reader of this cache.
+3 -3
View File
@@ -45,10 +45,10 @@ from common import (
parse_md5_list,
require_directory,
)
from hashing import parse_hash_list
from nativemode import digest_algorithm
from core.hashing import parse_hash_list
from resolve.nativemode import digest_algorithm
from dedup import _in_nodedup_dir
from validation import frontend_digest_matches, inner_rom_check
from resolve.validation import frontend_digest_matches, inner_rom_check
try:
import yaml
+3 -3
View File
@@ -207,7 +207,7 @@ def _group_requirement_split(path: Path, document: object) -> list[str]:
that can contradict the first: a true on the first name only wrote the
search order into required, and the other names read as optional.
"""
from alternatives import groups_of
from model.alternatives import groups_of
if not isinstance(document, dict):
return []
@@ -558,7 +558,7 @@ def _save_dir_without_library_name(path: Path, document: object) -> list[str]:
(sort_savefiles_enable): without the name, packs and the installer
cannot say where the file goes, and leave it out.
"""
from validation import read_from_save_dir
from resolve.validation import read_from_save_dir
if not isinstance(document, dict):
return []
@@ -581,7 +581,7 @@ def _save_folder_once_paths(path: Path, document: dict) -> list[str]:
frontend sorts saves by core or not, which holds only when the path
already names the folder the core reads below.
"""
from validation import read_from_save_dir
from resolve.validation import read_from_save_dir
if not document.get("save_folder_once"):
return []
Loaded 100 of 167 files, more files were not shown because too many files have changed in this diff. Show more