mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-27 11:58:53 -06:00
refactor: public names for cross-module reads
This commit is contained in:
1 parent
f371790dc6
commit
3853ca2f1c
254 files changed
+2955
-2969
No files matched your search
+15
-15
@@ -12,10 +12,10 @@ from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
|
||||
from core.artifacts import set_plain_mode
|
||||
from core.deterministic_zip import _FIXED_DATE_TIME
|
||||
from core.deterministic_zip import FIXED_DATE_TIME
|
||||
from core.hashing import compute_hashes
|
||||
from core.paths import sanitize_pack_path
|
||||
from packs.paths import _has_path_conflict, _register_path, placement_block
|
||||
from packs.paths import has_path_conflict, register_path, placement_block
|
||||
|
||||
|
||||
# Formats that are already compressed: deflating them again took 28 s of the
|
||||
@@ -54,7 +54,7 @@ class PackRecord:
|
||||
self.sources: dict[str, str] = {}
|
||||
|
||||
|
||||
def _add_pack_member(
|
||||
def add_pack_member(
|
||||
zf: zipfile.ZipFile | PackRecord, source_path: str, arcname: str
|
||||
) -> None:
|
||||
"""Add a file to the pack with metadata that does not depend on the build.
|
||||
@@ -71,7 +71,7 @@ def _add_pack_member(
|
||||
zf.members.append(arcname)
|
||||
zf.sources[arcname] = source_path
|
||||
return
|
||||
info = zipfile.ZipInfo(filename=arcname, date_time=_FIXED_DATE_TIME)
|
||||
info = zipfile.ZipInfo(filename=arcname, date_time=FIXED_DATE_TIME)
|
||||
info.compress_type = _member_compression(arcname)
|
||||
# The executable bit is the one permission worth carrying: the RetroDECK
|
||||
# pack ships the two Voxatron engine binaries, and a user who extracts
|
||||
@@ -89,7 +89,7 @@ def _add_pack_member(
|
||||
shutil.copyfileobj(source, target, 1024 * 1024)
|
||||
|
||||
|
||||
def _write_generated_member(
|
||||
def write_generated_member(
|
||||
zf: zipfile.ZipFile | PackRecord, arcname: str, text: str
|
||||
) -> None:
|
||||
"""Write a pack member the builder composes rather than copies.
|
||||
@@ -102,14 +102,14 @@ def _write_generated_member(
|
||||
if isinstance(zf, PackRecord):
|
||||
zf.members.append(arcname)
|
||||
return
|
||||
info = zipfile.ZipInfo(filename=arcname, date_time=_FIXED_DATE_TIME)
|
||||
info = zipfile.ZipInfo(filename=arcname, date_time=FIXED_DATE_TIME)
|
||||
info.compress_type = zipfile.ZIP_DEFLATED
|
||||
info.external_attr = 0o100644 << 16
|
||||
zf.writestr(info, text)
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def _writing_pack(zip_path: str) -> Iterator[zipfile.ZipFile]:
|
||||
def writing_pack(zip_path: str) -> Iterator[zipfile.ZipFile]:
|
||||
"""A pack written beside its final name, swapped in once complete.
|
||||
|
||||
Opened on the final name, a rebuild truncated the previous pack at once,
|
||||
@@ -137,7 +137,7 @@ PACK_DOCUMENTS = ("README.txt", "manifest.json")
|
||||
|
||||
|
||||
@dataclass
|
||||
class _Placed:
|
||||
class Placed:
|
||||
"""The destinations a build has taken, and the folders they open.
|
||||
|
||||
``fold`` is whether a case twin of a taken path counts as taken.
|
||||
@@ -150,7 +150,7 @@ class _Placed:
|
||||
|
||||
def take(self, dest: str) -> None:
|
||||
self.destinations.add(dest)
|
||||
_register_path(dest, self.destinations, self.parents)
|
||||
register_path(dest, self.destinations, self.parents)
|
||||
if self.fold:
|
||||
self.lower.add(dest.lower())
|
||||
|
||||
@@ -158,13 +158,13 @@ class _Placed:
|
||||
return dest in self.destinations or (self.fold and dest.lower() in self.lower)
|
||||
|
||||
def conflicts(self, dest: str) -> bool:
|
||||
return _has_path_conflict(dest, self.destinations, self.parents)
|
||||
return has_path_conflict(dest, self.destinations, self.parents)
|
||||
|
||||
def block(self, dest: str) -> str | None:
|
||||
return placement_block(dest, self.destinations, self.lower, self.parents, self.fold)
|
||||
|
||||
|
||||
def _extract_zip_to_archive(
|
||||
def extract_zip_to_archive(
|
||||
source_zip: str,
|
||||
dest_prefix: str,
|
||||
target_zf: zipfile.ZipFile | PackRecord,
|
||||
@@ -188,14 +188,14 @@ def _extract_zip_to_archive(
|
||||
data = src.read(info.filename)
|
||||
target_path = f"{dest_prefix}/{clean_name}" if dest_prefix else clean_name
|
||||
member = zipfile.ZipInfo(
|
||||
filename=target_path, date_time=_FIXED_DATE_TIME
|
||||
filename=target_path, date_time=FIXED_DATE_TIME
|
||||
)
|
||||
member.compress_type = _member_compression(target_path)
|
||||
member.external_attr = 0o100644 << 16
|
||||
target_zf.writestr(member, data)
|
||||
|
||||
|
||||
def _add_zip_to_pack(
|
||||
def add_zip_to_pack(
|
||||
source_zip: str,
|
||||
dest_path: str,
|
||||
target_zf: zipfile.ZipFile | PackRecord,
|
||||
@@ -214,7 +214,7 @@ def _add_zip_to_pack(
|
||||
target_zf.sources[dest_path] = source_zip
|
||||
return
|
||||
_check_zip_members(source_zip)
|
||||
_add_pack_member(target_zf, source_zip, dest_path)
|
||||
add_pack_member(target_zf, source_zip, dest_path)
|
||||
|
||||
|
||||
def _check_zip_members(source_zip: str) -> None:
|
||||
@@ -241,7 +241,7 @@ class DamagedArchiveError(OSError):
|
||||
"""An archive of the collection whose members fail their own CRC."""
|
||||
|
||||
|
||||
def _same_bytes(path: str, other: str | None) -> bool:
|
||||
def same_bytes(path: str, other: str | None) -> bool:
|
||||
if not other:
|
||||
return False
|
||||
if os.path.realpath(path) == os.path.realpath(other):
|
||||
|
||||
+14
-14
@@ -21,9 +21,9 @@ from packs.verdicts import (
|
||||
RELEASE_ASSET_PENDING,
|
||||
Severity,
|
||||
Status,
|
||||
_SEVERITY_ORDER,
|
||||
_STATUS_ORDER,
|
||||
_storage_verdict,
|
||||
SEVERITY_ORDER,
|
||||
STATUS_ORDER,
|
||||
storage_verdict,
|
||||
compute_severity,
|
||||
verify_entry_existence,
|
||||
verify_entry_md5,
|
||||
@@ -34,7 +34,7 @@ from resolve.cores import platform_scope_systems, resolve_platform_cores
|
||||
from resolve.launchers import launcher_unproven
|
||||
from resolve.nativemode import digest_algorithm, normalize as normalize_mode, reads_file_contents
|
||||
from resolve.validation import (
|
||||
_build_validation_index,
|
||||
build_validation_index,
|
||||
agnostic_substitute,
|
||||
baseline_verdict,
|
||||
build_ground_truth,
|
||||
@@ -158,7 +158,7 @@ def _builder_placement(
|
||||
path -> copy or None for each slot kept, a user_provided or external one
|
||||
included).
|
||||
"""
|
||||
from packs.paths import _has_path_conflict, _register_path
|
||||
from packs.paths import has_path_conflict, register_path
|
||||
|
||||
shipped: dict[str, str] = {}
|
||||
occupied: dict[str, str | None] = {}
|
||||
@@ -172,10 +172,10 @@ def _builder_placement(
|
||||
if (
|
||||
full in occupied
|
||||
or (case_insensitive and full.lower() in folded)
|
||||
or _has_path_conflict(full, seen, parents)
|
||||
or has_path_conflict(full, seen, parents)
|
||||
):
|
||||
continue
|
||||
_register_path(full, seen, parents)
|
||||
register_path(full, seen, parents)
|
||||
folded.add(full.lower())
|
||||
occupied[full] = local
|
||||
if local is not None:
|
||||
@@ -414,7 +414,7 @@ class _PlatformTally:
|
||||
"""The declaration's result, and the local copy the pack writes for it."""
|
||||
config = self.run.config
|
||||
mode = self.run.mode
|
||||
stored = _storage_verdict(file_entry, emulator_pack=False)
|
||||
stored = storage_verdict(file_entry, emulator_pack=False)
|
||||
if resolve_status == RELEASE_ASSET_PENDING:
|
||||
# Counted as an online build counts it, which fetches the
|
||||
# asset. Under --offline the builder cannot, and neither
|
||||
@@ -496,11 +496,11 @@ class _PlatformTally:
|
||||
return
|
||||
del self.file_status[dest], self.file_severity[dest]
|
||||
prev = None
|
||||
if prev is None or _STATUS_ORDER.get(cur, 0) > _STATUS_ORDER.get(prev, 0):
|
||||
if prev is None or STATUS_ORDER.get(cur, 0) > STATUS_ORDER.get(prev, 0):
|
||||
self.file_status[dest] = cur
|
||||
self.file_required[dest] = required
|
||||
prev_sev = self.file_severity.get(dest)
|
||||
if prev_sev is None or _SEVERITY_ORDER.get(sev, 0) > _SEVERITY_ORDER.get(
|
||||
if prev_sev is None or SEVERITY_ORDER.get(sev, 0) > SEVERITY_ORDER.get(
|
||||
prev_sev, 0
|
||||
):
|
||||
self.file_severity[dest] = sev
|
||||
@@ -819,7 +819,7 @@ def verify_platform(
|
||||
for f in profile.get("files", [])
|
||||
if f.get("hle_fallback")
|
||||
}
|
||||
validation_index = _build_validation_index(platform_profiles)
|
||||
validation_index = build_validation_index(platform_profiles)
|
||||
validation_owners = destination_owners(platform_profiles)
|
||||
|
||||
verify_systems = platform_scope_systems(config, profiles, target_cores, system_filter)
|
||||
@@ -906,11 +906,11 @@ def verify_platform(
|
||||
# (base_destination stripped, as the builder flattens it). The pipeline
|
||||
# compares this set with the archive: equal counts can hide one file
|
||||
# credited here and another written there.
|
||||
from packs.paths import _flat
|
||||
from packs.paths import flat_arcname
|
||||
|
||||
pack_destinations = sorted(
|
||||
{_flat(dest, base_dest, True) for dest in shipped} | {
|
||||
_flat(dest, base_dest, True) for dest in placed
|
||||
{flat_arcname(dest, base_dest, True) for dest in shipped} | {
|
||||
flat_arcname(dest, base_dest, True) for dest in placed
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
+15
-15
@@ -20,15 +20,15 @@ from model.database import get_mame_clone_map
|
||||
from model.declarations import OUTER_ROOTS
|
||||
from model.platforms import load_platform_config
|
||||
from model.registry import list_registered_platforms, load_data_dir_registry
|
||||
from model.systems import _norm_system_id
|
||||
from packs.gaps import _gap_destination
|
||||
from model.systems import norm_system_id
|
||||
from packs.gaps import gap_destination
|
||||
from resolve.archives import archive_entry
|
||||
from resolve.content import content_fits, name_match_size_ok
|
||||
from resolve.directories import directory_members, expand_directory_entries
|
||||
from resolve.launchers import (
|
||||
LauncherLayer,
|
||||
_directories as launcher_directories,
|
||||
_names as launcher_names,
|
||||
record_directories as launcher_directories,
|
||||
record_names as launcher_names,
|
||||
bound_launchers,
|
||||
catalogued_model_files,
|
||||
held_record,
|
||||
@@ -39,7 +39,7 @@ from resolve.launchers import (
|
||||
)
|
||||
from resolve.layout import system_dir_path
|
||||
from resolve.localfile import resolve_local_file
|
||||
from resolve.ownership import _foreign_tree, _owner_tokens
|
||||
from resolve.ownership import foreign_tree, owner_tokens
|
||||
from resolve.standalone import platform_layouts
|
||||
from resolve.validation import (
|
||||
case_folded_slots,
|
||||
@@ -80,11 +80,11 @@ def load_platform_files(
|
||||
for fe in system.get("files", []):
|
||||
name = fe.get("name", "")
|
||||
if name:
|
||||
declared.setdefault(_norm_system_id(sys_id), set()).add(name)
|
||||
declared.setdefault(norm_system_id(sys_id), set()).add(name)
|
||||
for dd in system.get("data_directories", []):
|
||||
ref = dd.get("ref", "")
|
||||
if ref:
|
||||
platform_data_dirs.setdefault(_norm_system_id(sys_id), set()).add(ref)
|
||||
platform_data_dirs.setdefault(norm_system_id(sys_id), set()).add(ref)
|
||||
return declared, platform_data_dirs
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ def folded_declared_slots(
|
||||
return frozenset(slots)
|
||||
|
||||
|
||||
def _build_supplemental_index(
|
||||
def build_supplemental_index(
|
||||
data_root: str = "data", bios_root: str = "bios"
|
||||
) -> set[str]:
|
||||
"""Build a set of filenames and directory names in data/ and inside bios/ ZIPs.
|
||||
@@ -214,7 +214,7 @@ def _resolve_source(
|
||||
refuse it.
|
||||
"""
|
||||
declared = _declared_content(file_entry or {})
|
||||
owners = _owner_tokens(file_entry or {})
|
||||
owners = owner_tokens(file_entry or {})
|
||||
|
||||
def _can_be(sha1s: list | str) -> bool:
|
||||
if not file_entry or db_files is None:
|
||||
@@ -237,7 +237,7 @@ def _resolve_source(
|
||||
return _can_be([
|
||||
sha1 for sha1 in by_name.get(name) or []
|
||||
if db_files is None
|
||||
or not _foreign_tree(db_files.get(sha1, {}).get("path", ""), owners)
|
||||
or not foreign_tree(db_files.get(sha1, {}).get("path", ""), owners)
|
||||
])
|
||||
|
||||
# bios/ via database.json by_name
|
||||
@@ -660,7 +660,7 @@ def _resolve_archive_source(
|
||||
return result if result is not None else "missing"
|
||||
|
||||
|
||||
def _first_hash(entry: dict) -> str:
|
||||
def first_hash(entry: dict) -> str:
|
||||
"""The first hash an entry declares, strongest first, or ''."""
|
||||
for field in ("sha1", "sha256", "md5", "crc32"):
|
||||
value = entry.get(field)
|
||||
@@ -761,7 +761,7 @@ class _ProfileComparison:
|
||||
# takes it: Batocera's standalone Cemu reads keys.txt at
|
||||
# standalone_path, and the libretro Cemu/keys.txt reported here
|
||||
# settled the declaration on a slot the platform never fills.
|
||||
effective_path = _gap_destination(f, fname, is_standalone, save_root)
|
||||
effective_path = gap_destination(f, fname, is_standalone, save_root)
|
||||
slot = slot_key(f, is_standalone)
|
||||
seen_key = slot
|
||||
if len(self.layouts) > 1:
|
||||
@@ -907,7 +907,7 @@ class _ProfileComparison:
|
||||
"in_repo": in_repo,
|
||||
"source": source,
|
||||
# What tells this file from a homonym another emulator wants.
|
||||
"identity": _first_hash(f),
|
||||
"identity": first_hash(f),
|
||||
}
|
||||
if save_root:
|
||||
entry["root"] = "save"
|
||||
@@ -1011,7 +1011,7 @@ def _cross_reference_profile(
|
||||
else:
|
||||
platform_names = set()
|
||||
for sys_id in systems:
|
||||
platform_names.update(declared.get(_norm_system_id(sys_id), set()))
|
||||
platform_names.update(declared.get(norm_system_id(sys_id), set()))
|
||||
|
||||
# The build a platform runs decides which entries it reads, as in
|
||||
# find_undeclared_files: without a platform, the libretro build.
|
||||
@@ -1108,7 +1108,7 @@ PLATFORM_OWN_FOLDERS = frozenset({"<emulatorLauncher folder>"})
|
||||
def launcher_file_names(record: dict) -> list[str]:
|
||||
"""The concrete file names a launcher record reads, in code order.
|
||||
|
||||
The names are read as the launcher layer reads them (`launchers._names`):
|
||||
The names are read as the launcher layer reads them (`launchers.record_names`):
|
||||
a label after the name is dropped ("neocd_z.rom (CDZ)"), and a name with
|
||||
`<` or without an extension is not a file name (a folder the record
|
||||
links, an option value such as hatari2014's "default"). A name with a
|
||||
|
||||
@@ -24,7 +24,7 @@ from core.artifacts import file_lock as _file_lock, set_plain_mode
|
||||
from core.cli import InputMissing
|
||||
from core.github import github_token
|
||||
from model.safeparse import yaml_load
|
||||
from model.registry import VERSIONS_FILE, _load_versions
|
||||
from model.registry import VERSIONS_FILE, load_versions
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@@ -155,7 +155,7 @@ def _record_version(key: str, record: dict, versions_path: str) -> None:
|
||||
"""Set one key under the file lock, so two writers keep both updates."""
|
||||
path = Path(versions_path)
|
||||
with _file_lock(path.with_name(f".{path.name}.lock")):
|
||||
versions = _load_versions(versions_path)
|
||||
versions = load_versions(versions_path)
|
||||
versions[key] = record
|
||||
_save_versions(versions, versions_path)
|
||||
|
||||
@@ -437,7 +437,7 @@ def _record_archive_size(key: str, entry: dict, versions_path: str) -> None:
|
||||
"""
|
||||
path = Path(versions_path)
|
||||
with _file_lock(path.with_name(f".{path.name}.lock")):
|
||||
versions = _load_versions(versions_path)
|
||||
versions = load_versions(versions_path)
|
||||
record = versions.get(key)
|
||||
if record is None or "archive_size" in record:
|
||||
return
|
||||
@@ -446,7 +446,7 @@ def _record_archive_size(key: str, entry: dict, versions_path: str) -> None:
|
||||
if size is None:
|
||||
return
|
||||
with _file_lock(path.with_name(f".{path.name}.lock")):
|
||||
versions = _load_versions(versions_path)
|
||||
versions = load_versions(versions_path)
|
||||
if key in versions and "archive_size" not in versions[key]:
|
||||
versions[key]["archive_size"] = size
|
||||
_save_versions(versions, versions_path)
|
||||
@@ -513,7 +513,7 @@ def _decide(
|
||||
"""(whether the tree needs a refresh, the remote tag read, the recorded
|
||||
tag). None when the remote could not be read."""
|
||||
version = entry.get("version", "master")
|
||||
cached = _load_versions(versions_path).get(key, {})
|
||||
cached = load_versions(versions_path).get(key, {})
|
||||
cached_tag = cached.get("sha") or cached.get("etag")
|
||||
if force or not Path(entry["local_cache"]).exists():
|
||||
return True, None, cached_tag
|
||||
|
||||
+18
-18
@@ -13,11 +13,11 @@ from core.hashing import compute_hashes
|
||||
from core.options import reject_unknown
|
||||
from model.declarations import declared_root
|
||||
from model.profiles import entry_system_ids, installed_data_refs
|
||||
from model.systems import _norm_system_id
|
||||
from packs.archive import PackRecord, _add_pack_member
|
||||
from model.systems import norm_system_id
|
||||
from packs.archive import PackRecord, add_pack_member
|
||||
from packs.datadirs import cache_lock
|
||||
from packs.extras import prefixed_destination
|
||||
from packs.paths import MEDIA_MARKER, _has_path_conflict, _register_path, lands_on_android
|
||||
from packs.paths import MEDIA_MARKER, has_path_conflict, register_path, lands_on_android
|
||||
from resolve.cores import resolve_platform_cores as _platform_cores
|
||||
from resolve.layout import core_system_dirs
|
||||
from resolve.standalone import platform_layouts, standalone_set
|
||||
@@ -113,7 +113,7 @@ def core_data_trees(
|
||||
return trees
|
||||
|
||||
|
||||
def _in_data_cache(path: str, data_registry: dict | None) -> bool:
|
||||
def in_data_cache(path: str, data_registry: dict | None) -> bool:
|
||||
"""Whether a resolved file lies in one of the data directory caches."""
|
||||
real = os.path.realpath(path)
|
||||
return any(
|
||||
@@ -136,7 +136,7 @@ def _tree_references(
|
||||
|
||||
|
||||
class _TreeWalkOptions(TypedDict, total=False):
|
||||
"""The keyword options of _data_directory_members."""
|
||||
"""The keyword options of data_directory_members."""
|
||||
|
||||
refs_out: dict | None
|
||||
required_only: bool
|
||||
@@ -160,7 +160,7 @@ def _carried_tree(dd: dict, data_registry: dict | None, platform_name: str) -> s
|
||||
print(
|
||||
f" WARNING: data directory '{ref_key}' not cached at {local_path} (run refresh_data_dirs.py)"
|
||||
)
|
||||
_MISSING_DATA_DIRS.add(ref_key)
|
||||
MISSING_DATA_DIRS.add(ref_key)
|
||||
return None
|
||||
return local_path
|
||||
|
||||
@@ -174,7 +174,7 @@ def _tree_files(local_path: str, dd_prefix: str) -> Iterator[tuple[str, str]]:
|
||||
yield src, f"{dd_prefix}/{rel}" if dd_prefix else rel
|
||||
|
||||
|
||||
def _data_directory_members(
|
||||
def data_directory_members(
|
||||
pack_systems: dict,
|
||||
data_registry: dict | None,
|
||||
platform_name: str,
|
||||
@@ -205,7 +205,7 @@ def _data_directory_members(
|
||||
``required_only`` leaves out a tree declared ``required: false``, one the
|
||||
core runs without, as it leaves out such a file.
|
||||
"""
|
||||
reject_unknown("_data_directory_members", options, _TreeWalkOptions.__optional_keys__)
|
||||
reject_unknown("data_directory_members", options, _TreeWalkOptions.__optional_keys__)
|
||||
refs_out = options.get("refs_out")
|
||||
reclaim = options.get("reclaim")
|
||||
required_only = options.get("required_only", False)
|
||||
@@ -231,11 +231,11 @@ def _data_directory_members(
|
||||
del reclaim[full]
|
||||
elif full in seen_destinations or (
|
||||
full.lower() in seen_lower and case_insensitive
|
||||
) or _has_path_conflict(full, seen_destinations, seen_parents):
|
||||
) or has_path_conflict(full, seen_destinations, seen_parents):
|
||||
continue
|
||||
else:
|
||||
seen_destinations.add(full)
|
||||
_register_path(full, seen_destinations, seen_parents)
|
||||
register_path(full, seen_destinations, seen_parents)
|
||||
if case_insensitive:
|
||||
seen_lower.add(full.lower())
|
||||
if refs_out is not None:
|
||||
@@ -243,7 +243,7 @@ def _data_directory_members(
|
||||
yield src, full
|
||||
|
||||
|
||||
def _pack_data_tree(
|
||||
def pack_data_tree(
|
||||
zf: zipfile.ZipFile | PackRecord,
|
||||
local_cache: str,
|
||||
dd_dest: str,
|
||||
@@ -266,14 +266,14 @@ def _pack_data_tree(
|
||||
src = os.path.join(root, fname)
|
||||
rel = os.path.relpath(src, local_cache)
|
||||
full = f"{dd_dest}/{rel}" if dd_dest else rel
|
||||
if full.lower() in seen_lower or _has_path_conflict(
|
||||
if full.lower() in seen_lower or has_path_conflict(
|
||||
full, seen_destinations, seen_parents
|
||||
):
|
||||
continue
|
||||
seen_destinations.add(full)
|
||||
_register_path(full, seen_destinations, seen_parents)
|
||||
register_path(full, seen_destinations, seen_parents)
|
||||
seen_lower.add(full.lower())
|
||||
_add_pack_member(zf, src, full)
|
||||
add_pack_member(zf, src, full)
|
||||
if packed_at is not None:
|
||||
packed_at[full.lower()] = src
|
||||
added += 1
|
||||
@@ -283,7 +283,7 @@ def _pack_data_tree(
|
||||
# Data directories a pack needed and the cache did not hold. The pack is
|
||||
# written without them, so the run cannot exit as if it were complete: a
|
||||
# refresh refused by a quota left the PPSSPP pack with 2 files, exit 0.
|
||||
_MISSING_DATA_DIRS: set[str] = set()
|
||||
MISSING_DATA_DIRS: set[str] = set()
|
||||
|
||||
|
||||
def tree_readers(pack_systems: dict, core_trees: Iterable[dict]) -> dict[str, list[str]]:
|
||||
@@ -341,7 +341,7 @@ def _tree_group(
|
||||
return group
|
||||
|
||||
|
||||
def _manifest_data_directories(
|
||||
def manifest_data_directories(
|
||||
members: list[tuple[str, str]],
|
||||
refs: dict[str, tuple[str, tuple[str, ...], str, bool]],
|
||||
registry: dict,
|
||||
@@ -373,11 +373,11 @@ def _manifest_data_directories(
|
||||
versions: dict[str, dict[str, dict]] = {}
|
||||
by_norm: dict[str, list[str]] = {}
|
||||
for sys_id in sorted(platform_systems or ()):
|
||||
by_norm.setdefault(_norm_system_id(sys_id), []).append(sys_id)
|
||||
by_norm.setdefault(norm_system_id(sys_id), []).append(sys_id)
|
||||
for src, full in members:
|
||||
ref, systems, prefix, needed = refs[full]
|
||||
if platform_systems is not None:
|
||||
systems = tuple(own for sid in systems for own in by_norm.get(_norm_system_id(sid), ()))
|
||||
systems = tuple(own for sid in systems for own in by_norm.get(norm_system_id(sid), ()))
|
||||
key = (ref, prefix)
|
||||
group = grouped.get(key)
|
||||
if group is None:
|
||||
|
||||
@@ -26,15 +26,15 @@ from packs.verdicts import (
|
||||
RELEASE_ASSET_PENDING,
|
||||
Severity,
|
||||
Status,
|
||||
_SEVERITY_ORDER,
|
||||
_STATUS_ORDER,
|
||||
_emulator_severity,
|
||||
_storage_verdict,
|
||||
SEVERITY_ORDER,
|
||||
STATUS_ORDER,
|
||||
emulator_severity,
|
||||
storage_verdict,
|
||||
)
|
||||
from resolve.archives import archive_entry, archive_is_optional
|
||||
from resolve.directories import expand_directory_entries
|
||||
from resolve.validation import (
|
||||
_build_validation_index,
|
||||
build_validation_index,
|
||||
build_ground_truth,
|
||||
deliverable,
|
||||
validated_choice,
|
||||
@@ -111,7 +111,7 @@ def _emulator_files(
|
||||
) -> list[dict]:
|
||||
"""The entries of a profile the emulator pack carries."""
|
||||
from packs.extras import expand_agnostic_entries
|
||||
from packs.paths import _resolve_destination
|
||||
from packs.paths import resolve_destination
|
||||
|
||||
files = expand_agnostic_entries(
|
||||
expand_directory_entries(
|
||||
@@ -142,7 +142,7 @@ def _emulator_files(
|
||||
fe
|
||||
for fe in files
|
||||
if fe.get("archive")
|
||||
or _resolve_destination(fe, standalone) not in region_drops
|
||||
or resolve_destination(fe, standalone) not in region_drops
|
||||
]
|
||||
return files
|
||||
|
||||
@@ -251,12 +251,12 @@ class _EmulatorPack:
|
||||
)
|
||||
|
||||
def occupy(self, dest: str, path: str | None, owner: str) -> None:
|
||||
from packs.paths import _register_path
|
||||
from packs.paths import register_path
|
||||
|
||||
if self.block(dest):
|
||||
return
|
||||
self.placed[dest.lower()] = (path, owner, dest)
|
||||
_register_path(dest, self.placed_files, self.placed_parents)
|
||||
register_path(dest, self.placed_files, self.placed_parents)
|
||||
|
||||
def occupy_trees(self, emu_name: str, profile: dict) -> None:
|
||||
"""The profile's data trees follow its files in the pack, which
|
||||
@@ -331,7 +331,7 @@ class _EmulatorPack:
|
||||
self, emu_name: str, profile: dict, files: list[dict], spares: set[str],
|
||||
) -> list[PlacedResult]:
|
||||
# Verify archives as units (e.g., neogeo.zip, aes.zip)
|
||||
from packs.paths import _archive_destination
|
||||
from packs.paths import archive_destination
|
||||
from resolve.packfiles import resolve_file
|
||||
|
||||
placed_results: list[PlacedResult] = []
|
||||
@@ -344,7 +344,7 @@ class _EmulatorPack:
|
||||
own_entry = archive_entry(archive, files)
|
||||
# Where the pack puts it: an archive_prefix or pack_structure
|
||||
# moves it, and a loose same-named entry is another file.
|
||||
dest = _archive_destination(
|
||||
dest = archive_destination(
|
||||
archive, profile.get("archive_prefix", ""),
|
||||
profile.get("pack_structure"), self.standalone,
|
||||
)
|
||||
@@ -387,7 +387,7 @@ class _EmulatorPack:
|
||||
def _loose_results(
|
||||
self, emu_name: str, files: list[dict],
|
||||
) -> dict[str, list[tuple[dict, bool, bool, dict]]]:
|
||||
from packs.paths import _resolve_destination
|
||||
from packs.paths import resolve_destination
|
||||
from resolve.packfiles import resolve_file
|
||||
|
||||
# Results of this emulator, by destination. Several entries of one
|
||||
@@ -426,7 +426,7 @@ class _EmulatorPack:
|
||||
result["ground_truth"] = build_ground_truth(name, self.validation_index)
|
||||
# The slot the emulator pack places this entry in: standalone_path
|
||||
# under --standalone, the sanitised path.
|
||||
dest = _resolve_destination(file_entry, self.standalone) or name
|
||||
dest = resolve_destination(file_entry, self.standalone) or name
|
||||
emu_results.setdefault(dest, []).append((result, required, hle, file_entry))
|
||||
return emu_results
|
||||
|
||||
@@ -435,7 +435,7 @@ class _EmulatorPack:
|
||||
resolve_status: str, emu_name: str,
|
||||
) -> dict:
|
||||
"""The verdict on a loose profile entry, from its resolution."""
|
||||
stored = _storage_verdict(file_entry, emulator_pack=True)
|
||||
stored = storage_verdict(file_entry, emulator_pack=True)
|
||||
if stored is not None:
|
||||
return stored
|
||||
if resolve_status == RELEASE_ASSET_PENDING:
|
||||
@@ -589,15 +589,15 @@ class _EmulatorPack:
|
||||
self.dest_to_name[dest] = result["name"]
|
||||
cur = result["status"]
|
||||
prev = self.file_status.get(dest)
|
||||
if prev is None or _STATUS_ORDER.get(cur, 0) > _STATUS_ORDER.get(
|
||||
if prev is None or STATUS_ORDER.get(cur, 0) > STATUS_ORDER.get(
|
||||
prev, 0
|
||||
):
|
||||
self.file_status[dest] = cur
|
||||
sev = _emulator_severity(cur, required, hle)
|
||||
sev = emulator_severity(cur, required, hle)
|
||||
prev_sev = self.file_severity.get(dest)
|
||||
if prev_sev is None or _SEVERITY_ORDER.get(
|
||||
if prev_sev is None or SEVERITY_ORDER.get(
|
||||
sev, 0
|
||||
) > _SEVERITY_ORDER.get(prev_sev, 0):
|
||||
) > SEVERITY_ORDER.get(prev_sev, 0):
|
||||
self.file_severity[dest] = sev
|
||||
|
||||
|
||||
@@ -632,7 +632,7 @@ def verify_emulator(
|
||||
file or tree marked ``required: false`` is left out, and an archive when
|
||||
it and every member it carries are optional, as the builder leaves them.
|
||||
"""
|
||||
from packs.paths import _resolve_destination
|
||||
from packs.paths import resolve_destination
|
||||
|
||||
# Also load aliases for redirect messages
|
||||
all_profiles = load_emulator_profiles(emulators_dir, skip_aliases=False)
|
||||
@@ -649,7 +649,7 @@ def verify_emulator(
|
||||
|
||||
# Build validation index from selected profiles only
|
||||
selected_profiles = dict(selected)
|
||||
validation_index = _build_validation_index(selected_profiles)
|
||||
validation_index = build_validation_index(selected_profiles)
|
||||
data_registry = load_data_dir_registry(platforms_dir)
|
||||
|
||||
pack = _EmulatorPack(
|
||||
@@ -681,7 +681,7 @@ def verify_emulator(
|
||||
)
|
||||
files = [
|
||||
fe for fe in files
|
||||
if fe.get("archive") or _resolve_destination(fe, standalone) not in spares
|
||||
if fe.get("archive") or resolve_destination(fe, standalone) not in spares
|
||||
]
|
||||
pack.verify_profile(emu_name, profile, files, spares)
|
||||
|
||||
|
||||
@@ -29,23 +29,23 @@ from model.registry import load_data_dir_registry
|
||||
from model.systems import MANUFACTURER_PREFIXES, system_index
|
||||
from packs.archive import (
|
||||
PackRecord,
|
||||
_Placed,
|
||||
_add_pack_member,
|
||||
_add_zip_to_pack,
|
||||
_same_bytes,
|
||||
_write_generated_member,
|
||||
_writing_pack,
|
||||
Placed,
|
||||
add_pack_member,
|
||||
add_zip_to_pack,
|
||||
same_bytes,
|
||||
write_generated_member,
|
||||
writing_pack,
|
||||
)
|
||||
from packs.datatrees import _MISSING_DATA_DIRS, _pack_data_tree
|
||||
from packs.datatrees import MISSING_DATA_DIRS, pack_data_tree
|
||||
from packs.extras import emulator_region_drops, emulator_required_spares, expand_agnostic_entries
|
||||
from packs.naming import _bounded_join, _bounded_pack_name, _name_part, _narrowings
|
||||
from packs.paths import _archive_destination, _resolve_destination
|
||||
from packs.naming import bounded_join, bounded_pack_name, file_name_part, pack_narrowings
|
||||
from packs.paths import archive_destination, resolve_destination
|
||||
from resolve import packfiles as packresolve
|
||||
from resolve.archives import archive_entry, archive_is_optional
|
||||
from resolve.directories import expand_directory_entries
|
||||
from resolve.packfiles import download_external, resolve_file
|
||||
from resolve.validation import (
|
||||
_build_validation_index,
|
||||
build_validation_index,
|
||||
deliverable,
|
||||
validated_choice,
|
||||
with_archive_members,
|
||||
@@ -100,7 +100,7 @@ class _EmulatorPackBuild:
|
||||
discrepancies: list[str] = field(default_factory=list)
|
||||
unsourceable_files: list[str] = field(default_factory=list)
|
||||
instruction_files: list[str] = field(default_factory=list)
|
||||
placed: _Placed = field(default_factory=lambda: _Placed(True))
|
||||
placed: Placed = field(default_factory=lambda: Placed(True))
|
||||
seen_hashes: set[str] = field(default_factory=set) # SHA1 dedup for same file, different path
|
||||
# Loose file packed at each folded destination, to tell a profile asking
|
||||
# for the same file there from one asking for other bytes.
|
||||
@@ -118,9 +118,9 @@ class _EmulatorPackBuild:
|
||||
def _add(self, local_path: str, dest: str, fe: dict | None) -> None:
|
||||
"""Write a loose file or an archive at dest and count it."""
|
||||
if fe is not None and local_path.endswith(".zip"):
|
||||
_add_zip_to_pack(local_path, dest, self.zf, fe)
|
||||
add_zip_to_pack(local_path, dest, self.zf, fe)
|
||||
else:
|
||||
_add_pack_member(self.zf, local_path, dest)
|
||||
add_pack_member(self.zf, local_path, dest)
|
||||
self.placed.take(dest)
|
||||
self.total_files += 1
|
||||
if self.record is not None:
|
||||
@@ -156,7 +156,7 @@ class _EmulatorPackBuild:
|
||||
# Pack archives as units
|
||||
archive_prefix = profile.get("archive_prefix", "")
|
||||
for archive_name in sorted({fe["archive"] for fe in files if fe.get("archive")}):
|
||||
archive_dest = _archive_destination(
|
||||
archive_dest = archive_destination(
|
||||
archive_name, archive_prefix, pack_structure, self.standalone
|
||||
)
|
||||
own_entry = archive_entry(archive_name, files)
|
||||
@@ -196,7 +196,7 @@ class _EmulatorPackBuild:
|
||||
# profile without its archive, which used to pass in
|
||||
# silence: a neocdz.zip lacking 000-lo.lo shipped as the
|
||||
# one the second core needs.
|
||||
if not (taken and local_path and _same_bytes(
|
||||
if not (taken and local_path and same_bytes(
|
||||
local_path, self.packed_at.get(archive_dest.lower())
|
||||
)):
|
||||
return ([own_entry], False, functools.partial(
|
||||
@@ -223,7 +223,7 @@ class _EmulatorPackBuild:
|
||||
continue
|
||||
if fe.get("archive"):
|
||||
continue
|
||||
dest = _resolve_destination(fe, self.standalone)
|
||||
dest = resolve_destination(fe, self.standalone)
|
||||
if not dest or dest in spares:
|
||||
continue
|
||||
if self.region_drops and dest in self.region_drops:
|
||||
@@ -237,7 +237,7 @@ class _EmulatorPackBuild:
|
||||
self.placed.take(dest)
|
||||
instr = provided.get("instructions", "Please provide this file manually.")
|
||||
folder = dest.rsplit("/", 1)[0] + "/" if "/" in dest else ""
|
||||
_write_generated_member(
|
||||
write_generated_member(
|
||||
self.zf,
|
||||
f"{folder}INSTRUCTIONS_{provided['name']}.txt",
|
||||
f"File needed: {provided['name']}\n\n{instr}\n",
|
||||
@@ -314,7 +314,7 @@ class _EmulatorPackBuild:
|
||||
else None if chosen is not None else refused_path
|
||||
)
|
||||
if chosen is not None or held is not None:
|
||||
if block == "taken" and held and _same_bytes(
|
||||
if block == "taken" and held and same_bytes(
|
||||
held, self.packed_at.get(dest.lower())
|
||||
):
|
||||
# The file already at this path, asked for twice.
|
||||
@@ -400,7 +400,7 @@ class _EmulatorPackBuild:
|
||||
prefix = pack_structure.get(mode_key, "")
|
||||
if prefix:
|
||||
dd_dest = f"{prefix}/{dd_dest}" if dd_dest else prefix
|
||||
self.data_files += _pack_data_tree(
|
||||
self.data_files += pack_data_tree(
|
||||
self.zf, local_cache, dd_dest, self.placed.destinations,
|
||||
self.placed.parents, self.placed.lower, self.packed_at,
|
||||
)
|
||||
@@ -441,7 +441,7 @@ class _EmulatorPackBuild:
|
||||
print(
|
||||
f" Note: data directory '{ref}' required but not included (use refresh_data_dirs.py)"
|
||||
)
|
||||
_MISSING_DATA_DIRS.update(self.data_dir_notices)
|
||||
MISSING_DATA_DIRS.update(self.data_dir_notices)
|
||||
|
||||
|
||||
def generate_emulator_pack(
|
||||
@@ -483,15 +483,15 @@ def generate_emulator_pack(
|
||||
|
||||
record = options.get("record")
|
||||
# ZIP naming
|
||||
display_names = [_name_part(p.get("emulator", n)) for n, p in selected]
|
||||
validation_index = _build_validation_index(dict(selected))
|
||||
display_names = [file_name_part(p.get("emulator", n)) for n, p in selected]
|
||||
validation_index = build_validation_index(dict(selected))
|
||||
narrow_tags = "".join(
|
||||
tag
|
||||
for tag, _label in _narrowings(
|
||||
for tag, _label in pack_narrowings(
|
||||
"full", regions, None, False, required_only, standalone
|
||||
)
|
||||
)
|
||||
zip_name = options.get("pack_name") or _bounded_pack_name(
|
||||
zip_name = options.get("pack_name") or bounded_pack_name(
|
||||
display_names, [n for n, _p in selected], f"{narrow_tags}_BIOS_Pack.zip"
|
||||
)
|
||||
zip_path = os.path.join(output_dir, zip_name)
|
||||
@@ -511,7 +511,7 @@ def generate_emulator_pack(
|
||||
)
|
||||
with (
|
||||
contextlib.nullcontext(record) if record is not None
|
||||
else _writing_pack(zip_path)
|
||||
else writing_pack(zip_path)
|
||||
) as zf:
|
||||
build = _EmulatorPackBuild(
|
||||
db, bios_dir, standalone, required_only, zip_contents, data_registry,
|
||||
@@ -589,8 +589,8 @@ def generate_system_pack(
|
||||
|
||||
# Named like the platform's --system tag: one spelling of a system is
|
||||
# one file name, and one selection.
|
||||
sys_display = _bounded_join(
|
||||
[_system_display_name(sid) for sid in system_ids], list(system_ids)
|
||||
sys_display = bounded_join(
|
||||
[system_display_name(sid) for sid in system_ids], list(system_ids)
|
||||
)
|
||||
# Built in a scratch directory: under its emulator name in output_dir it
|
||||
# overwrote, then carried away, an --emulator pack already there.
|
||||
@@ -599,7 +599,7 @@ def generate_system_pack(
|
||||
# tag made --system X --required-only overwrite the pack built without it.
|
||||
tags = "".join(
|
||||
tag
|
||||
for tag, _label in _narrowings(
|
||||
for tag, _label in pack_narrowings(
|
||||
"full", regions, None, False, required_only, standalone=standalone
|
||||
)
|
||||
)
|
||||
@@ -634,7 +634,7 @@ def generate_system_pack(
|
||||
shutil.rmtree(scratch, ignore_errors=True)
|
||||
|
||||
|
||||
def _system_display_name(system_id: str) -> str:
|
||||
def system_display_name(system_id: str) -> str:
|
||||
"""Convert system ID to display name for ZIP naming."""
|
||||
s = system_id.lower().replace("_", "-")
|
||||
for prefix in MANUFACTURER_PREFIXES:
|
||||
|
||||
+37
-37
@@ -12,7 +12,7 @@ from typing import TYPE_CHECKING, TypedDict
|
||||
|
||||
from core.options import reject_unknown
|
||||
from model.profiles import PROFILE_IDENTITY_FIELDS, entry_system_ids
|
||||
from model.systems import _norm_system_id
|
||||
from model.systems import norm_system_id
|
||||
from model.alternatives import core_file_spares, required_only_spares, set_fields
|
||||
from resolve.archives import archive_members, contents_members, holds_required_members
|
||||
from model.declarations import declared_root, expand_platform_declared_names, platform_declarations
|
||||
@@ -34,7 +34,7 @@ if TYPE_CHECKING:
|
||||
from typing_extensions import Unpack
|
||||
|
||||
|
||||
def _detect_extras_prefix(config: dict, base_dest: str) -> str:
|
||||
def detect_extras_prefix(config: dict, base_dest: str) -> str:
|
||||
"""The prefix core-extra destinations take (may be empty).
|
||||
|
||||
When base_destination is empty (RetroDECK), it is the dominant root of
|
||||
@@ -198,7 +198,7 @@ def _map_emulator_to_slug(
|
||||
sys_to_slug: dict[str, str],
|
||||
) -> str:
|
||||
"""Map an emulator to a destination slug for slug-based platforms."""
|
||||
from model.systems import _norm_system_id
|
||||
from model.systems import norm_system_id
|
||||
|
||||
emu_systems = set(profile.get("systems", []))
|
||||
# Direct match
|
||||
@@ -208,7 +208,7 @@ def _map_emulator_to_slug(
|
||||
return sys_to_slug.get(target, "")
|
||||
# Normalized match
|
||||
for es in sorted(emu_systems):
|
||||
norm = _norm_system_id(es)
|
||||
norm = norm_system_id(es)
|
||||
if norm in norm_map:
|
||||
target = norm_map[norm]
|
||||
return sys_to_slug.get(target, "")
|
||||
@@ -404,7 +404,7 @@ def hidden_extras(
|
||||
``required_only`` are the builder's for a --source truth or a
|
||||
--required-only pack: an optional extra is skipped before it takes a path.
|
||||
"""
|
||||
from packs.paths import _register_path, placement_block
|
||||
from packs.paths import register_path, placement_block
|
||||
|
||||
reject_unknown("hidden_extras", options, HiddenOptions.__optional_keys__)
|
||||
report = options.get("report")
|
||||
@@ -423,14 +423,14 @@ def hidden_extras(
|
||||
parents: set[str] = set()
|
||||
content: dict[str, str | None] = {}
|
||||
for dest, local in shipped.items():
|
||||
_register_path(dest, seen, parents)
|
||||
register_path(dest, seen, parents)
|
||||
content[dest.lower()] = sha1_by_path.get(local)
|
||||
lower = set(content) if case_insensitive else set()
|
||||
prefix = _detect_extras_prefix(config, base_dest)
|
||||
prefix = detect_extras_prefix(config, base_dest)
|
||||
region_prefix = declared_root(config)
|
||||
hidden: dict[tuple[str, str, str], str] = {}
|
||||
packed_keys: set[tuple[str, str, str]] = set()
|
||||
extras = _collect_emulator_extras(
|
||||
extras = collect_emulator_extras(
|
||||
config, emulators_dir, db, set() if system_ids else set(shipped),
|
||||
base_dest, profiles, target_cores=target_cores, include_all=include_all,
|
||||
undeclared=report,
|
||||
@@ -474,7 +474,7 @@ def hidden_extras(
|
||||
hidden.setdefault(key, reason)
|
||||
continue
|
||||
packed_keys.add(key)
|
||||
_register_path(full, seen, parents)
|
||||
register_path(full, seen, parents)
|
||||
content[full.lower()] = held
|
||||
if case_insensitive:
|
||||
lower.add(full.lower())
|
||||
@@ -1275,9 +1275,9 @@ class ExtraPlacement:
|
||||
"""
|
||||
|
||||
def __init__(self, config: dict, base_dest: str, profiles: dict) -> None:
|
||||
from model.systems import _norm_system_id
|
||||
from model.systems import norm_system_id
|
||||
|
||||
self.prefix = _detect_extras_prefix(config, base_dest)
|
||||
self.prefix = detect_extras_prefix(config, base_dest)
|
||||
self.slug_based, self.sys_to_slug = _detect_slug_structure(config)
|
||||
self.platform_systems = set(config.get("systems", {}).keys())
|
||||
self.native_systems = native_slug_systems(config)
|
||||
@@ -1289,7 +1289,7 @@ class ExtraPlacement:
|
||||
self.outer = {root for root in OUTER_ROOTS if outer_layout(config, root)}
|
||||
self.config = config
|
||||
self.norm_map = (
|
||||
{_norm_system_id(sid): sid for sid in self.platform_systems}
|
||||
{norm_system_id(sid): sid for sid in self.platform_systems}
|
||||
if self.slug_based
|
||||
else {}
|
||||
)
|
||||
@@ -1393,7 +1393,7 @@ def undeclared_report(
|
||||
target_cores: set[str] | None = None,
|
||||
include_all: bool = False,
|
||||
) -> list[dict]:
|
||||
"""The gap report _collect_emulator_extras reads, for a caller that
|
||||
"""The gap report collect_emulator_extras reads, for a caller that
|
||||
collects the extras more than once with these arguments: the region
|
||||
grouping and the pack or manifest phase 2 each computed it in full."""
|
||||
from packs.gaps import find_undeclared_files
|
||||
@@ -1406,7 +1406,7 @@ def undeclared_report(
|
||||
|
||||
|
||||
class CollectOptions(TypedDict, total=False):
|
||||
"""The records _collect_emulator_extras fills, and the report it reuses."""
|
||||
"""The records collect_emulator_extras fills, and the report it reuses."""
|
||||
|
||||
claimants: dict[tuple[str, str, str], str] | None
|
||||
unplaceable: list[dict] | None
|
||||
@@ -1447,7 +1447,7 @@ class _CopyScope:
|
||||
extras_prefix: str
|
||||
|
||||
|
||||
def _collect_emulator_extras(
|
||||
def collect_emulator_extras(
|
||||
config: dict,
|
||||
emulators_dir: str,
|
||||
db: dict,
|
||||
@@ -1490,7 +1490,7 @@ def _collect_emulator_extras(
|
||||
|
||||
Works for ANY platform (RetroArch, Batocera, Recalbox, etc.)
|
||||
"""
|
||||
reject_unknown("_collect_emulator_extras", options, CollectOptions.__optional_keys__)
|
||||
reject_unknown("collect_emulator_extras", options, CollectOptions.__optional_keys__)
|
||||
undeclared = options.get("undeclared")
|
||||
claimants = options.get("claimants")
|
||||
unplaceable = options.get("unplaceable")
|
||||
@@ -2042,25 +2042,25 @@ def _another_claim(extra: dict | None, claim: dict) -> None:
|
||||
claims.sort(key=lambda c: c["claim_order"])
|
||||
|
||||
|
||||
def _extra_system_ids(extra: dict) -> list[str]:
|
||||
def extra_system_ids(extra: dict) -> list[str]:
|
||||
"""Return the narrowest system ownership preserved on a core extra."""
|
||||
explicit = extra.get("source_system")
|
||||
if explicit:
|
||||
return [str(explicit)]
|
||||
return [str(value) for value in extra.get("source_systems", []) if value]
|
||||
|
||||
def _serving_system_ids(extra: dict) -> list[str]:
|
||||
def serving_system_ids(extra: dict) -> list[str]:
|
||||
"""Every system the extra's file serves: its own core's and those of the
|
||||
other cores whose claim rides on it. One file stands per destination, so
|
||||
narrowed to any of their systems the file is what that core reads.
|
||||
"""
|
||||
ids = list(_extra_system_ids(extra))
|
||||
ids = list(extra_system_ids(extra))
|
||||
for claim in extra.get("other_claims", []):
|
||||
ids.extend(s for s in _extra_system_ids(claim) if s not in ids)
|
||||
ids.extend(s for s in extra_system_ids(claim) if s not in ids)
|
||||
return ids
|
||||
|
||||
|
||||
def _kept(entries: list[dict], required_only: bool) -> list[dict]:
|
||||
def kept_entries(entries: list[dict], required_only: bool) -> list[dict]:
|
||||
"""The entries a pack keeps: optional ones go under --required-only."""
|
||||
if not required_only:
|
||||
return entries
|
||||
@@ -2073,12 +2073,12 @@ def extras_for_systems(extras: list[dict], system_ids: list[str]) -> list[dict]:
|
||||
Extras carry their profile/system identity directly. Display labels are
|
||||
presentation only and must never drive routing.
|
||||
"""
|
||||
wanted = set(system_ids) | {_norm_system_id(s) for s in system_ids}
|
||||
wanted = set(system_ids) | {norm_system_id(s) for s in system_ids}
|
||||
return [
|
||||
fe for fe in extras
|
||||
if (
|
||||
set(_serving_system_ids(fe))
|
||||
| {_norm_system_id(s) for s in _serving_system_ids(fe)}
|
||||
set(serving_system_ids(fe))
|
||||
| {norm_system_id(s) for s in serving_system_ids(fe)}
|
||||
) & wanted
|
||||
]
|
||||
|
||||
@@ -2187,7 +2187,7 @@ def platform_region_groups(
|
||||
members = groups.setdefault(sys_id, [])
|
||||
# Decided over what the pack keeps: an optional winner removed
|
||||
# afterwards left its slot empty.
|
||||
for file_entry in _kept(system.get("files", []), required_only):
|
||||
for file_entry in kept_entries(system.get("files", []), required_only):
|
||||
dest = declared_destination(file_entry)
|
||||
if dest:
|
||||
members.append((dest, file_entry.get("name", "")))
|
||||
@@ -2203,7 +2203,7 @@ def platform_region_groups(
|
||||
return groups, extra_dests
|
||||
|
||||
absent: list[dict] = []
|
||||
extras = _collect_emulator_extras(
|
||||
extras = collect_emulator_extras(
|
||||
config,
|
||||
emulators_dir,
|
||||
db,
|
||||
@@ -2219,7 +2219,7 @@ def platform_region_groups(
|
||||
held = {id(extra) for extra in extras}
|
||||
spellings = system_spellings(systems)
|
||||
region_prefix = declared_root(config)
|
||||
for extra in _kept(extras + absent, required_only):
|
||||
for extra in kept_entries(extras + absent, required_only):
|
||||
dest = extra_region_key(extra, region_prefix)
|
||||
if not dest:
|
||||
continue
|
||||
@@ -2255,7 +2255,7 @@ def system_spellings(systems: Iterable[str]) -> dict[str, str]:
|
||||
"""
|
||||
spellings: dict[str, str] = {}
|
||||
for sys_id in sorted(systems):
|
||||
spellings.setdefault(_norm_system_id(sys_id), sys_id)
|
||||
spellings.setdefault(norm_system_id(sys_id), sys_id)
|
||||
return spellings
|
||||
|
||||
|
||||
@@ -2268,7 +2268,7 @@ def extra_region_groups(
|
||||
extra competes beside the files the platform declares for that system.
|
||||
"""
|
||||
def system_group(sys_id: str) -> str:
|
||||
return (spellings or {}).get(_norm_system_id(sys_id), sys_id)
|
||||
return (spellings or {}).get(norm_system_id(sys_id), sys_id)
|
||||
|
||||
emulator = extra.get("source_emulator", "")
|
||||
variant = extra.get("selection_slot")
|
||||
@@ -2314,19 +2314,19 @@ def emulator_region_drops(
|
||||
emulator pack resolves with.
|
||||
"""
|
||||
from resolve import regions as resolve_regions
|
||||
from packs.paths import _resolve_destination
|
||||
from resolve.validation import _build_validation_index, filter_files_by_mode
|
||||
from packs.paths import resolve_destination
|
||||
from resolve.validation import build_validation_index, filter_files_by_mode
|
||||
|
||||
region_index = resolve_regions.build_region_index(dict(selected))
|
||||
region_groups: dict[str, list[tuple[str, str]]] = {}
|
||||
held: set[str] | None = set() if db is not None else None
|
||||
validation_index = _build_validation_index(dict(selected)) if db is not None else {}
|
||||
validation_index = build_validation_index(dict(selected)) if db is not None else {}
|
||||
for emu_name, profile in sorted(selected):
|
||||
# Decided over what the pack keeps, as on the platform side: an
|
||||
# optional winner removed afterwards left its slot empty.
|
||||
entries = filter_files_by_mode(profile.get("files", []), standalone)
|
||||
for fe in _kept(entries, required_only):
|
||||
dest = _resolve_destination(fe, standalone)
|
||||
for fe in kept_entries(entries, required_only):
|
||||
dest = resolve_destination(fe, standalone)
|
||||
if dest:
|
||||
group_id = _emulator_region_group(emu_name, profile, fe, dest)
|
||||
region_groups.setdefault(group_id, []).append(
|
||||
@@ -2362,7 +2362,7 @@ def emulator_required_spares(
|
||||
stvbios.zip. The pack and verify --emulator both read this."""
|
||||
from model.alternatives import groups_of, rank_in, required_groups
|
||||
from resolve.archives import archive_entry
|
||||
from packs.paths import _archive_destination, _resolve_destination
|
||||
from packs.paths import archive_destination, resolve_destination
|
||||
|
||||
reject_unknown("emulator_required_spares", options, SpareOptions.__optional_keys__)
|
||||
data_registry = options.get("data_registry")
|
||||
@@ -2374,12 +2374,12 @@ def emulator_required_spares(
|
||||
archives.append(archive)
|
||||
own = archive_entry(archive, files)
|
||||
if groups_of(own):
|
||||
candidates.append({"dest": _archive_destination(
|
||||
candidates.append({"dest": archive_destination(
|
||||
archive, profile.get("archive_prefix", ""),
|
||||
profile.get("pack_structure"), standalone,
|
||||
), "entry": own})
|
||||
candidates.extend(
|
||||
{"dest": _resolve_destination(fe, standalone), "entry": fe}
|
||||
{"dest": resolve_destination(fe, standalone), "entry": fe}
|
||||
for fe in files if not fe.get("archive") and groups_of(fe)
|
||||
)
|
||||
if not candidates:
|
||||
|
||||
+10
-10
@@ -17,16 +17,16 @@ from core.artifacts import set_plain_mode
|
||||
from core.options import reject_unknown
|
||||
from model.registry import list_registered_platforms
|
||||
from model.targets import load_target_config
|
||||
from packs.archive import _write_generated_member
|
||||
from packs.archive import write_generated_member
|
||||
from packs.integrity import generate_sha256sums, verify_pack, verify_pack_against_platform
|
||||
from packs.naming import _expected_pack_names, _narrows_contents, _pack_archives
|
||||
from packs.naming import expected_pack_names, narrows_contents, pack_archives
|
||||
from packs.scope import annotate_pack_systems
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing_extensions import Unpack
|
||||
|
||||
|
||||
def _baseline_shortfall(excluded: int, absent: int) -> list[str]:
|
||||
def baseline_shortfall(excluded: int, absent: int) -> list[str]:
|
||||
"""Why a verified pack holds fewer baseline files than the platform declares."""
|
||||
parts = []
|
||||
if excluded:
|
||||
@@ -43,7 +43,7 @@ def inject_manifest(zip_path: str, manifest: dict) -> None:
|
||||
"""Inject manifest.json into an existing ZIP pack.
|
||||
|
||||
The pack is rewritten beside its final name and swapped in, as
|
||||
_writing_pack builds it: appending in place rewrites the central
|
||||
writing_pack builds it: appending in place rewrites the central
|
||||
directory last, so a process killed in between left an unreadable ZIP
|
||||
where a valid pack had been.
|
||||
"""
|
||||
@@ -64,7 +64,7 @@ def inject_manifest(zip_path: str, manifest: dict) -> None:
|
||||
# two different byte layouts depending on the path taken here.
|
||||
shutil.copyfile(zip_path, scratch)
|
||||
with zipfile.ZipFile(scratch, "a", zipfile.ZIP_DEFLATED) as zf:
|
||||
_write_generated_member(zf, "manifest.json", manifest_json)
|
||||
write_generated_member(zf, "manifest.json", manifest_json)
|
||||
else:
|
||||
with zipfile.ZipFile(zip_path, "r") as src, \
|
||||
zipfile.ZipFile(scratch, "w", zipfile.ZIP_DEFLATED) as dst:
|
||||
@@ -72,7 +72,7 @@ def inject_manifest(zip_path: str, manifest: dict) -> None:
|
||||
if item.filename == "manifest.json":
|
||||
continue
|
||||
dst.writestr(item, src.read(item.filename))
|
||||
_write_generated_member(dst, "manifest.json", manifest_json)
|
||||
write_generated_member(dst, "manifest.json", manifest_json)
|
||||
set_plain_mode(scratch)
|
||||
os.replace(scratch, zip_path)
|
||||
except BaseException:
|
||||
@@ -149,7 +149,7 @@ def _conforms(zip_path: str, pname: str, db: dict, opts: _FinalizeSettings) -> b
|
||||
)
|
||||
status = "OK" if p_ok else "FAILED"
|
||||
exclusion_note = "".join(
|
||||
f", {part}" for part in _baseline_shortfall(bl_excluded, bl_absent)
|
||||
f", {part}" for part in baseline_shortfall(bl_excluded, bl_absent)
|
||||
)
|
||||
print(
|
||||
f" platform {pname}: {bl_present}/{bl_checked} baseline present"
|
||||
@@ -192,11 +192,11 @@ def verify_and_finalize_packs(
|
||||
# substring: a _Custom or regional pack left by another run was judged
|
||||
# against this run's expectation and failed it.
|
||||
registered = list_registered_platforms(opts.platforms_dir)
|
||||
expected = _expected_pack_names(
|
||||
expected = expected_pack_names(
|
||||
registered, opts.platforms_dir, opts.regions, opts.target_name,
|
||||
no_game_data=opts.no_game_data,
|
||||
)
|
||||
packs = _pack_archives(output_dir)
|
||||
packs = pack_archives(output_dir)
|
||||
if opts.built is not None:
|
||||
packs = [name for name in packs if name in set(opts.built)]
|
||||
pack_to_platform: dict[str, list[str]] = {}
|
||||
@@ -229,7 +229,7 @@ def verify_and_finalize_packs(
|
||||
# Skipped for filtered/split/custom packs (intentionally partial)
|
||||
if opts.skip_conformance:
|
||||
continue
|
||||
if _narrows_contents(name):
|
||||
if narrows_contents(name):
|
||||
continue
|
||||
for pname in pack_to_platform.get(name, []):
|
||||
if not _conforms(zip_path, pname, db, opts):
|
||||
|
||||
@@ -17,10 +17,10 @@ from resolve.launchers import LauncherLayer, declared_destinations, held_record
|
||||
from resolve.layout import runs_standalone, system_dir_path
|
||||
from resolve.localfile import resolve_local_file
|
||||
from resolve.nativemode import hash_mismatch_excludes_file
|
||||
from resolve.ownership import _foreign_tree, _owner_tokens
|
||||
from resolve.ownership import foreign_tree, owner_tokens
|
||||
from resolve.standalone import platform_layouts, standalone_set as platform_standalone_set
|
||||
from resolve.validation import (
|
||||
_parse_validation,
|
||||
parse_validation,
|
||||
case_folded_slots,
|
||||
core_size_refusal,
|
||||
declaration_settles,
|
||||
@@ -56,7 +56,7 @@ def _build_expected(file_entry: dict, checks: list[str]) -> dict:
|
||||
|
||||
def _in_foreign_tree(db: dict, owners: set[str], sha1: str) -> bool:
|
||||
"""Whether the collection keeps this sha1 in another emulator's tree."""
|
||||
return _foreign_tree(db.get("files", {}).get(sha1, {}).get("path", ""), owners)
|
||||
return foreign_tree(db.get("files", {}).get(sha1, {}).get("path", ""), owners)
|
||||
|
||||
|
||||
def _name_in_index(
|
||||
@@ -137,7 +137,7 @@ def _identity_of(entry: dict) -> dict:
|
||||
}
|
||||
|
||||
|
||||
def _gap_destination(f: dict, fname: str, is_standalone: bool, save_root: bool) -> str:
|
||||
def gap_destination(f: dict, fname: str, is_standalone: bool, save_root: bool) -> str:
|
||||
"""The destination a gap entry is keyed and reported at."""
|
||||
# One destination rule for the dedup key and for the entry: a
|
||||
# standalone build without standalone_path falls back on path.
|
||||
@@ -206,7 +206,7 @@ class _GapScan:
|
||||
"""Consider one profile entry of one build as a gap."""
|
||||
fname = f.get("name", "")
|
||||
save_root = read_from_save_dir(f, is_standalone)
|
||||
dest = _gap_destination(f, fname, is_standalone, save_root)
|
||||
dest = gap_destination(f, fname, is_standalone, save_root)
|
||||
region_key = _region_key(f)
|
||||
# Same-name requirements at different paths, for different systems,
|
||||
# or in distinct variant groups are not interchangeable.
|
||||
@@ -350,7 +350,7 @@ class _GapScan:
|
||||
_lp, _st = resolve_local_file(owned, self.db, dest_hint=dest)
|
||||
return _lp is not None and _st != "hash_mismatch"
|
||||
in_repo = self._held_by_name(owned, f, fname, dest)
|
||||
if in_repo and "size" in _parse_validation(f.get("validation")):
|
||||
if in_repo and "size" in parse_validation(f.get("validation")):
|
||||
# On any platform the core measures what it opens: a
|
||||
# copy it turns away by its own size check is not
|
||||
# held for it, the rule the builder's lookup applies
|
||||
@@ -364,7 +364,7 @@ class _GapScan:
|
||||
return in_repo
|
||||
|
||||
def _held_by_name(self, owned: dict, f: dict, fname: str, dest: str) -> bool:
|
||||
foreign = functools.partial(_in_foreign_tree, self.db, _owner_tokens(owned))
|
||||
foreign = functools.partial(_in_foreign_tree, self.db, owner_tokens(owned))
|
||||
in_repo = _name_in_index(
|
||||
fname, self.by_name, self.by_path_suffix, self.data_names, self.by_name_lower,
|
||||
foreign,
|
||||
@@ -407,7 +407,7 @@ class _GapScan:
|
||||
self, emu_name: str, layout: dict, f: dict, fname: str, dest: str,
|
||||
in_repo: bool, save_root: bool,
|
||||
) -> dict:
|
||||
checks = _parse_validation(f.get("validation"))
|
||||
checks = parse_validation(f.get("validation"))
|
||||
entry = {
|
||||
"profile": emu_name,
|
||||
"emulator": layout.get("emulator", emu_name),
|
||||
|
||||
@@ -11,8 +11,8 @@ from dataclasses import dataclass, field
|
||||
from typing import TYPE_CHECKING, TypedDict
|
||||
|
||||
from packs.verdicts import DEFAULT_BIOS_DIR
|
||||
from core.artifacts import _build_timestamp
|
||||
from packs.paths import MEDIA_MARKER, _has_path_conflict
|
||||
from core.artifacts import build_timestamp
|
||||
from packs.paths import MEDIA_MARKER, has_path_conflict
|
||||
from core.ziptools import build_zip_contents_index
|
||||
from core.ziptools import check_inside_zip
|
||||
from resolve.nativemode import digest_algorithm
|
||||
@@ -28,7 +28,7 @@ from model.profiles import load_emulator_profiles
|
||||
from model.platforms import load_platform_config
|
||||
import os
|
||||
from packs.extras import platform_region_groups
|
||||
from packs.paths import _flat
|
||||
from packs.paths import flat_arcname
|
||||
from resolve.nativemode import reads_file_contents
|
||||
from resolve import regions as resolve_regions
|
||||
from packs import slots
|
||||
@@ -237,7 +237,7 @@ def verify_pack(
|
||||
"schema_version": 1,
|
||||
"version": 1,
|
||||
"generator": "retrobios generate_pack.py",
|
||||
"generated": _build_timestamp(db),
|
||||
"generated": build_timestamp(db),
|
||||
"files": [],
|
||||
}
|
||||
errors: list[str] = []
|
||||
@@ -595,7 +595,7 @@ def _builder_extras(
|
||||
there: taken by the refused file, that core file was never compared.
|
||||
"""
|
||||
from packs.extras import ExtraResolver, hidden_extras
|
||||
from resolve.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
|
||||
@@ -632,7 +632,7 @@ def _builder_extras(
|
||||
expect.region_drops or None,
|
||||
resolver=ExtraResolver(
|
||||
db, DEFAULT_BIOS_DIR, build_zip_contents_index(db), data_registry,
|
||||
_build_validation_index(platform_profiles),
|
||||
build_validation_index(platform_profiles),
|
||||
destination_owners(platform_profiles), True, profiles=emu_profiles,
|
||||
),
|
||||
placed_local=placed_local,
|
||||
@@ -855,7 +855,7 @@ def _count_baseline(
|
||||
member = expected
|
||||
elif expected.lower() in view.zip_lower:
|
||||
member = view.zip_lower[expected.lower()]
|
||||
elif _has_path_conflict(expected, view.zip_set, view.zip_parents):
|
||||
elif has_path_conflict(expected, view.zip_set, view.zip_parents):
|
||||
# Skipped by the builder for the same reason: not an error
|
||||
count.present += 1
|
||||
continue
|
||||
@@ -967,7 +967,7 @@ def _check_core_extras(
|
||||
)
|
||||
for full, local in sorted(placed_local.items()):
|
||||
core_checked += 1
|
||||
flat = _flat(full, expect.base_dest, view.is_flat)
|
||||
flat = flat_arcname(full, expect.base_dest, view.is_flat)
|
||||
member = flat if flat in view.zip_set else view.zip_lower.get(flat.lower())
|
||||
if member is None:
|
||||
errors.append(f"core missing: {full}")
|
||||
|
||||
+43
-43
@@ -9,7 +9,7 @@ from collections.abc import Callable, Iterator
|
||||
from dataclasses import dataclass, field
|
||||
from typing import TYPE_CHECKING, TypedDict
|
||||
|
||||
from core.artifacts import _build_timestamp
|
||||
from core.artifacts import build_timestamp
|
||||
from core.options import reject_unknown
|
||||
from core.paths import REPO_ROOT, declared_destination, sanitize_pack_path
|
||||
from model.declarations import OUTER_ROOTS, declared_root, outer_layout
|
||||
@@ -19,50 +19,50 @@ from model.registry import load_data_dir_registry
|
||||
from model.safeparse import yaml_load
|
||||
from model.systems import platform_system_names
|
||||
from packs import slots
|
||||
from packs.archive import CASE_FOLDING_OS, PACK_DOCUMENTS, _Placed
|
||||
from packs.archive import CASE_FOLDING_OS, PACK_DOCUMENTS, Placed
|
||||
from packs.datatrees import (
|
||||
_data_directory_members,
|
||||
_in_data_cache,
|
||||
_manifest_data_directories,
|
||||
data_directory_members,
|
||||
in_data_cache,
|
||||
manifest_data_directories,
|
||||
core_data_trees,
|
||||
pack_markers,
|
||||
tree_readers,
|
||||
)
|
||||
from packs.extras import (
|
||||
_collect_emulator_extras,
|
||||
collect_emulator_extras,
|
||||
extra_region_key,
|
||||
save_entry_fields,
|
||||
save_manifest_dest,
|
||||
undeclared_report,
|
||||
)
|
||||
from packs.manifestcores import (
|
||||
_downloaded_cores,
|
||||
_manifest_core_entries,
|
||||
_manifest_core_index,
|
||||
_manifest_selection,
|
||||
_offered_boards,
|
||||
downloaded_cores,
|
||||
manifest_core_entries,
|
||||
manifest_core_index,
|
||||
manifest_selection,
|
||||
offered_boards,
|
||||
)
|
||||
from packs.manifestentry import (
|
||||
MANIFEST_OUTER_FIELDS,
|
||||
_ClaimContext,
|
||||
_attach_claims,
|
||||
_manifest_dest_of,
|
||||
_manifest_entry,
|
||||
_record_absent,
|
||||
_record_slot_choices,
|
||||
_record_unplaceable,
|
||||
ClaimContext,
|
||||
attach_claims,
|
||||
manifest_dest_of,
|
||||
manifest_entry,
|
||||
record_absent,
|
||||
record_slot_choices,
|
||||
record_unplaceable,
|
||||
)
|
||||
from packs.manifestselect import SelectionIndex
|
||||
from packs.paths import save_layout
|
||||
from packs.scope import platform_list_version, system_titles
|
||||
from packs.standalone import _standalone_copies, _standalone_layouts
|
||||
from packs.standalone import standalone_copies, standalone_layouts
|
||||
from resolve.contentlayout import TARGET_KEY
|
||||
from resolve.cores import filter_systems_by_target, resolve_platform_cores as _platform_cores
|
||||
from resolve.gamedata import GAME_DATA, is_game_data, platform_game_data, without_game_data
|
||||
from resolve.nativemode import digest_algorithm, reads_file_contents
|
||||
from resolve.packfiles import preferred_entries as _preferred_entries, resolve_declaration
|
||||
from resolve.validation import (
|
||||
_build_validation_index,
|
||||
build_validation_index,
|
||||
agnostic_substitute,
|
||||
baseline_verdict,
|
||||
destination_owners,
|
||||
@@ -148,7 +148,7 @@ class _ManifestBuild:
|
||||
manifest_validation: dict = field(default_factory=dict)
|
||||
manifest_owners: dict = field(default_factory=dict)
|
||||
game_destinations: set[str] = field(default_factory=set)
|
||||
placed: _Placed = field(init=False)
|
||||
placed: Placed = field(init=False)
|
||||
# Destination -> (entry, full destination, manifest destination) of each
|
||||
# platform file, for the core claims a target build would fall back on.
|
||||
platform_entries: dict[str, tuple[dict, str, str]] = field(default_factory=dict)
|
||||
@@ -177,7 +177,7 @@ class _ManifestBuild:
|
||||
data_directories: list[dict] = field(default_factory=list)
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
self.placed = _Placed(self.case_insensitive)
|
||||
self.placed = Placed(self.case_insensitive)
|
||||
|
||||
@property
|
||||
def base_dest(self) -> str:
|
||||
@@ -197,7 +197,7 @@ class _ManifestBuild:
|
||||
return self.selection
|
||||
|
||||
def manifest_destination(self, full_destination: str) -> str:
|
||||
return _manifest_dest_of(full_destination, self.base_dest)
|
||||
return manifest_dest_of(full_destination, self.base_dest)
|
||||
|
||||
def record_omission(
|
||||
self,
|
||||
@@ -355,7 +355,7 @@ class _ManifestBuild:
|
||||
local_path: str,
|
||||
settle: _Settle,
|
||||
) -> None:
|
||||
entry, file_size = _manifest_entry(
|
||||
entry, file_size = manifest_entry(
|
||||
local_path, dest, None, self.db, self.repo_root,
|
||||
self.fields.fields(dest, file_entry["name"]),
|
||||
)
|
||||
@@ -364,14 +364,14 @@ class _ManifestBuild:
|
||||
if entry is not None and self.opts.target_cores is None:
|
||||
order = self.declaration_order(full_dest)
|
||||
if full_dest in self.slot_choices or len(order) > 1:
|
||||
_record_slot_choices(
|
||||
record_slot_choices(
|
||||
entry, self.slot_choices.get(full_dest, []), order,
|
||||
settle, dest, self.db, self.repo_root,
|
||||
)
|
||||
if entry is None:
|
||||
self.record_omission(full_dest, file_entry, sys_id, "not_found", None)
|
||||
if file_size and full_dest not in self.placed.destinations:
|
||||
if _in_data_cache(local_path, self.data_registry):
|
||||
if in_data_cache(local_path, self.data_registry):
|
||||
self.cache_held[full_dest] = (local_path, file_size)
|
||||
else:
|
||||
self.pack_only_sizes.append(file_size)
|
||||
@@ -384,8 +384,8 @@ class _ManifestBuild:
|
||||
self.total_size += file_size
|
||||
self.placed.take(full_dest)
|
||||
|
||||
def claim_context(self) -> _ClaimContext:
|
||||
return _ClaimContext(
|
||||
def claim_context(self) -> ClaimContext:
|
||||
return ClaimContext(
|
||||
self.db, self.bios_dir, self.zip_contents, self.opts.offline,
|
||||
self.opts.required_only, self.manifest_validation, self.manifest_owners,
|
||||
self.repo_root, self.data_registry,
|
||||
@@ -398,7 +398,7 @@ class _ManifestBuild:
|
||||
baseline_claims: dict[str, dict] = {}
|
||||
absent: list[dict] = []
|
||||
if opts.source != "platform":
|
||||
core_files = _collect_emulator_extras(
|
||||
core_files = collect_emulator_extras(
|
||||
self.config,
|
||||
opts.emulators_dir,
|
||||
self.db,
|
||||
@@ -414,12 +414,12 @@ class _ManifestBuild:
|
||||
)
|
||||
else:
|
||||
core_files = []
|
||||
_record_unplaceable(unplaceable, self.record_omission, self.config, self.emu_profiles)
|
||||
_record_absent(
|
||||
record_unplaceable(unplaceable, self.record_omission, self.config, self.emu_profiles)
|
||||
record_absent(
|
||||
absent, self.config, self.base_dest, self.region_drops, opts.required_only,
|
||||
self.placed.destinations, self.omitted_by_destination, self.record_omission,
|
||||
)
|
||||
self.total_size += _manifest_core_entries(
|
||||
self.total_size += manifest_core_entries(
|
||||
core_files, self.config, self.db, self.bios_dir, self.base_dest, self.repo_root,
|
||||
self.zip_contents, opts.offline,
|
||||
region_drops=self.region_drops, case_insensitive=self.case_insensitive,
|
||||
@@ -445,7 +445,7 @@ class _ManifestBuild:
|
||||
# still fills it.
|
||||
entry.pop("category", None)
|
||||
if claims:
|
||||
_attach_claims(entry, claims, ctx, dest, dest)
|
||||
attach_claims(entry, claims, ctx, dest, dest)
|
||||
# A platform omission narrows like a platform file: by the systems
|
||||
# declaring it, which can be fewer than the ones whose cores read it.
|
||||
for full_dest, omission in self.omitted_by_destination.items():
|
||||
@@ -471,7 +471,7 @@ class _ManifestBuild:
|
||||
core_trees = ([] if opts.source == "platform"
|
||||
else core_data_trees(self.config, self.emu_profiles, self.platform_name,
|
||||
self.data_registry, opts.target_cores))
|
||||
self.data_members = list(_data_directory_members(
|
||||
self.data_members = list(data_directory_members(
|
||||
self.pack_systems, self.data_registry, self.platform_name, self.base_dest,
|
||||
self.case_insensitive, self.placed.destinations, self.placed.lower,
|
||||
self.placed.parents, refs_out=data_refs, required_only=required_only,
|
||||
@@ -486,7 +486,7 @@ class _ManifestBuild:
|
||||
self.pack_only_sizes.append(size)
|
||||
else:
|
||||
self.omitted_by_destination.pop(full_dest, None)
|
||||
self.data_directories = _manifest_data_directories(
|
||||
self.data_directories = manifest_data_directories(
|
||||
self.data_members, data_refs, self.data_registry or {}, self.base_dest,
|
||||
tree_readers(self.pack_systems, core_trees), self.pack_systems,
|
||||
)
|
||||
@@ -499,7 +499,7 @@ class _ManifestBuild:
|
||||
# The pack is unzipped into the BIOS folder: an entry the installer puts
|
||||
# in the roms, emulators or configs folder is in its list, not in the ZIP.
|
||||
outer = [e for e in manifest_files if e.get("root") in OUTER_ROOTS]
|
||||
core_names, system_cores = _manifest_core_index(
|
||||
core_names, system_cores = manifest_core_index(
|
||||
config, self.emu_profiles, manifest_files, list(omitted.values())
|
||||
)
|
||||
result: dict = {
|
||||
@@ -521,10 +521,10 @@ class _ManifestBuild:
|
||||
"platform": platform_name,
|
||||
"display_name": config.get("platform", platform_name),
|
||||
"version": platform_list_version(config, platform_name),
|
||||
"generated": _build_timestamp(self.db),
|
||||
"generated": build_timestamp(self.db),
|
||||
"base_destination": self.base_dest,
|
||||
"detect": self.install_section.get("detect", []),
|
||||
"standalone_copies": _standalone_copies(
|
||||
"standalone_copies": standalone_copies(
|
||||
self.install_section.get("standalone_copies", []), self.manifest_profiles,
|
||||
manifest_files,
|
||||
),
|
||||
@@ -542,10 +542,10 @@ class _ManifestBuild:
|
||||
omitted.values(), key=lambda entry: entry["dest"]
|
||||
),
|
||||
"core_names": core_names,
|
||||
**({"downloaded_cores": downloaded} if (downloaded := _downloaded_cores(
|
||||
**({"downloaded_cores": downloaded} if (downloaded := downloaded_cores(
|
||||
config, self.emu_profiles, core_names, self.platforms_dir,
|
||||
)) else {}),
|
||||
**({"offered_boards": offered} if (offered := _offered_boards(
|
||||
**({"offered_boards": offered} if (offered := offered_boards(
|
||||
config, self.emu_profiles, core_names,
|
||||
[*manifest_files, *omitted.values()],
|
||||
)) else {}),
|
||||
@@ -634,7 +634,7 @@ def _start_manifest(
|
||||
name: emu_profiles[name]
|
||||
for name in _platform_cores(config, emu_profiles)
|
||||
}
|
||||
build.manifest_validation = _build_validation_index(build.manifest_profiles)
|
||||
build.manifest_validation = build_validation_index(build.manifest_profiles)
|
||||
build.manifest_owners = destination_owners(build.manifest_profiles)
|
||||
_settle_manifest_scope(build)
|
||||
return build, full_profiles
|
||||
@@ -679,7 +679,7 @@ def _settle_manifest_scope(build: _ManifestBuild) -> None:
|
||||
if opts.source != "platform"
|
||||
else None
|
||||
)
|
||||
build.region_drops, build.selection, build.builder_held = _manifest_selection(
|
||||
build.region_drops, build.selection, build.builder_held = manifest_selection(
|
||||
config, build.pack_systems, opts.emulators_dir, build.db, build.base_dest,
|
||||
emu_profiles, opts.target_cores, opts.source,
|
||||
required_only=opts.required_only, regions=opts.regions,
|
||||
@@ -822,7 +822,7 @@ def generate_install_list(
|
||||
**truth_options, known_slot_choices=built["slot_choices"],
|
||||
)
|
||||
_mark_truth(result, truth)
|
||||
layouts = _standalone_layouts(
|
||||
layouts = standalone_layouts(
|
||||
built["profiles"], settings.emulators_dir, db, bios_dir,
|
||||
settings.zip_contents or {}, settings.offline, platforms_dir, result,
|
||||
)
|
||||
|
||||
@@ -14,8 +14,8 @@ from model.profiles import upstream_profile_index
|
||||
from model.targets import list_available_targets, load_target_config
|
||||
from packs.extras import (
|
||||
ExtraResolver,
|
||||
_detect_extras_prefix,
|
||||
_extra_system_ids,
|
||||
detect_extras_prefix,
|
||||
extra_system_ids,
|
||||
extra_full_destination,
|
||||
extra_region_key,
|
||||
platform_region_groups,
|
||||
@@ -23,18 +23,18 @@ from packs.extras import (
|
||||
save_manifest_dest,
|
||||
)
|
||||
from packs.manifestentry import (
|
||||
_ClaimContext,
|
||||
_attach_claims,
|
||||
_claim_cores,
|
||||
_claim_platform_omission,
|
||||
_manifest_dest_of,
|
||||
_manifest_entry,
|
||||
ClaimContext,
|
||||
attach_claims,
|
||||
claim_cores,
|
||||
claim_platform_omission,
|
||||
manifest_dest_of,
|
||||
manifest_entry,
|
||||
)
|
||||
from packs.manifestselect import SelectionIndex
|
||||
from packs.paths import _register_path, placement_block
|
||||
from packs.platformpack import _slot_drops
|
||||
from packs.paths import register_path, placement_block
|
||||
from packs.platformpack import one_per_slot_drops
|
||||
from resolve import regions as resolve_regions, slot as slot_mod
|
||||
from resolve.contentlayout import TARGET_KEY, _core_key, content_folder_boards
|
||||
from resolve.contentlayout import TARGET_KEY, core_key, content_folder_boards
|
||||
from resolve.cores import (
|
||||
downloadable_on,
|
||||
downloaded_only_profiles,
|
||||
@@ -48,7 +48,7 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
class _CoreEntryState(TypedDict):
|
||||
"""What _manifest_core_entries reads and fills of the manifest being listed."""
|
||||
"""What manifest_core_entries reads and fills of the manifest being listed."""
|
||||
|
||||
region_drops: set
|
||||
case_insensitive: bool
|
||||
@@ -63,7 +63,7 @@ class _CoreEntryState(TypedDict):
|
||||
|
||||
|
||||
class _CoreEntryParts(_CoreEntryState, total=False):
|
||||
"""_CoreEntryState and the optional keywords of _manifest_core_entries."""
|
||||
"""_CoreEntryState and the optional keywords of manifest_core_entries."""
|
||||
|
||||
required_only: bool
|
||||
validation_index: dict | None
|
||||
@@ -78,14 +78,14 @@ class _CoreEntryLister:
|
||||
|
||||
config: dict
|
||||
base_dest: str
|
||||
ctx: _ClaimContext
|
||||
ctx: ClaimContext
|
||||
state: _CoreEntryParts
|
||||
resolver: ExtraResolver
|
||||
total_size: int = 0
|
||||
extras_pfx: str = field(init=False)
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
self.extras_pfx = _detect_extras_prefix(self.config, self.base_dest)
|
||||
self.extras_pfx = detect_extras_prefix(self.config, self.base_dest)
|
||||
|
||||
def region_key(self, fe: dict) -> str:
|
||||
return extra_region_key(fe, declared_root(self.config))
|
||||
@@ -139,7 +139,7 @@ class _CoreEntryLister:
|
||||
save_root = fe.get("root") == "save"
|
||||
folded = (
|
||||
save_manifest_dest(fe) if save_root
|
||||
else _manifest_dest_of(full_dest, self.base_dest)
|
||||
else manifest_dest_of(full_dest, self.base_dest)
|
||||
).lower()
|
||||
held = next(
|
||||
(e for e in self.state["manifest_files"]
|
||||
@@ -148,16 +148,16 @@ class _CoreEntryLister:
|
||||
None,
|
||||
)
|
||||
if held is not None and held.get("cores") is not None:
|
||||
_attach_claims(held, [fe], self.ctx, dest, held["dest"])
|
||||
attach_claims(held, [fe], self.ctx, dest, held["dest"])
|
||||
|
||||
def _omit(self, fe: dict, full_dest: str, reason: str) -> None:
|
||||
source_emu = fe.get("source_profile") or fe.get("source_emulator", "")
|
||||
if not _claim_platform_omission(
|
||||
if not claim_platform_omission(
|
||||
self.state["omitted_by_destination"].get(full_dest), source_emu
|
||||
):
|
||||
systems = _extra_system_ids(fe)
|
||||
systems = extra_system_ids(fe)
|
||||
self.state["record_omission"](
|
||||
full_dest, fe, systems[0] if systems else "", reason, _claim_cores(fe),
|
||||
full_dest, fe, systems[0] if systems else "", reason, claim_cores(fe),
|
||||
)
|
||||
|
||||
def _list_held(
|
||||
@@ -178,9 +178,9 @@ class _CoreEntryLister:
|
||||
# Relative to the roms or emulators folder the entry names.
|
||||
manifest_dest = dest
|
||||
else:
|
||||
manifest_dest = _manifest_dest_of(full_dest, self.base_dest)
|
||||
manifest_dest = manifest_dest_of(full_dest, self.base_dest)
|
||||
|
||||
entry, file_size = _manifest_entry(
|
||||
entry, file_size = manifest_entry(
|
||||
local_path, manifest_dest, [source_emu] if source_emu else [],
|
||||
self.ctx.db, self.ctx.repo_root,
|
||||
state["selection"].fields(region_key, fe.get("name", "")),
|
||||
@@ -199,7 +199,7 @@ class _CoreEntryLister:
|
||||
is_game_data(claim) for claim in fe.get("other_claims", [])
|
||||
):
|
||||
entry["category"] = GAME_DATA
|
||||
_attach_claims(entry, fe.get("other_claims", []), self.ctx, dest, manifest_dest)
|
||||
attach_claims(entry, fe.get("other_claims", []), self.ctx, dest, manifest_dest)
|
||||
|
||||
state["manifest_files"].append(entry)
|
||||
displaced = state["omitted_by_destination"].pop(full_dest, None)
|
||||
@@ -212,12 +212,12 @@ class _CoreEntryLister:
|
||||
)
|
||||
self.total_size += file_size
|
||||
state["seen_destinations"].add(full_dest)
|
||||
_register_path(full_dest, state["seen_destinations"], state["seen_parents"])
|
||||
register_path(full_dest, state["seen_destinations"], state["seen_parents"])
|
||||
if state["case_insensitive"]:
|
||||
state["seen_lower"].add(full_dest.lower())
|
||||
|
||||
|
||||
def _manifest_core_entries(
|
||||
def manifest_core_entries(
|
||||
core_files: list,
|
||||
config: dict,
|
||||
db: dict,
|
||||
@@ -236,11 +236,11 @@ def _manifest_core_entries(
|
||||
Returns the bytes added.
|
||||
"""
|
||||
reject_unknown(
|
||||
"_manifest_core_entries", state,
|
||||
"manifest_core_entries", state,
|
||||
_CoreEntryParts.__required_keys__ | _CoreEntryParts.__optional_keys__,
|
||||
)
|
||||
required_only = state.get("required_only", False)
|
||||
ctx = _ClaimContext(
|
||||
ctx = ClaimContext(
|
||||
db, bios_dir, zip_contents, offline, required_only,
|
||||
state.get("validation_index"), state.get("owners"), repo_root,
|
||||
state.get("data_registry"),
|
||||
@@ -261,7 +261,7 @@ def _manifest_core_entries(
|
||||
|
||||
|
||||
class _SelectionOptions(TypedDict, total=False):
|
||||
"""The keyword options of _manifest_selection."""
|
||||
"""The keyword options of manifest_selection."""
|
||||
|
||||
required_only: bool
|
||||
regions: list[str] | None
|
||||
@@ -272,7 +272,7 @@ class _SelectionOptions(TypedDict, total=False):
|
||||
one_per_slot: bool
|
||||
|
||||
|
||||
def _manifest_selection(
|
||||
def manifest_selection(
|
||||
config: dict,
|
||||
pack_systems: dict,
|
||||
emulators_dir: str,
|
||||
@@ -290,7 +290,7 @@ def _manifest_selection(
|
||||
decides on the full manifest withdraws what `--region` and
|
||||
`--one-per-slot` withdraw from the pack.
|
||||
"""
|
||||
reject_unknown("_manifest_selection", options, _SelectionOptions.__optional_keys__)
|
||||
reject_unknown("manifest_selection", options, _SelectionOptions.__optional_keys__)
|
||||
required_only = options.get("required_only", False)
|
||||
regions = options.get("regions")
|
||||
one_per_slot = options.get("one_per_slot", False)
|
||||
@@ -323,7 +323,7 @@ def _manifest_selection(
|
||||
else set()
|
||||
)
|
||||
if one_per_slot:
|
||||
drops = drops | _slot_drops(
|
||||
drops = drops | one_per_slot_drops(
|
||||
config, emu_profiles, target_cores, region_groups, drops, held
|
||||
)[0]
|
||||
return drops, SelectionIndex.build(
|
||||
@@ -333,7 +333,7 @@ def _manifest_selection(
|
||||
), held
|
||||
|
||||
|
||||
def _offered_boards(
|
||||
def offered_boards(
|
||||
config: dict,
|
||||
profiles: dict[str, dict],
|
||||
core_names: dict[str, list[str]],
|
||||
@@ -354,18 +354,18 @@ def _offered_boards(
|
||||
pairs = content_folder_boards(config)
|
||||
if all(on is None for on in pairs.values()):
|
||||
return {}
|
||||
from resolve.launchers import _roms_place
|
||||
from resolve.launchers import roms_place_of
|
||||
|
||||
by_key: dict[str, set[str]] = {}
|
||||
for name, claimants in upstream_profile_index(profiles).items():
|
||||
by_key.setdefault(_core_key(name), set()).update(claimants)
|
||||
by_key.setdefault(core_key(name), set()).update(claimants)
|
||||
free = {
|
||||
(profile, folder) for (core, folder), on in pairs.items() if on is None
|
||||
for profile in by_key.get(core, ())
|
||||
}
|
||||
found: dict[tuple[str, str, str], set[str]] = {}
|
||||
for (core, folder), on in pairs.items():
|
||||
where = _roms_place(config, folder) if on is not None else None
|
||||
where = roms_place_of(config, folder) if on is not None else None
|
||||
if where is None:
|
||||
continue
|
||||
for profile in by_key.get(core, ()):
|
||||
@@ -392,7 +392,7 @@ def _offered_boards(
|
||||
return result
|
||||
|
||||
|
||||
def _downloaded_cores(
|
||||
def downloaded_cores(
|
||||
config: dict,
|
||||
profiles: dict[str, dict],
|
||||
core_names: dict[str, list[str]],
|
||||
@@ -425,7 +425,7 @@ def _downloaded_cores(
|
||||
return {profile: sorted(names) for profile, names in sorted(boards.items())}
|
||||
|
||||
|
||||
def _manifest_core_index(
|
||||
def manifest_core_index(
|
||||
config: dict,
|
||||
profiles: dict[str, dict],
|
||||
files: list[dict],
|
||||
|
||||
@@ -12,8 +12,8 @@ from core.paths import declared_destination
|
||||
from model.declarations import OUTER_ROOTS, declared_root
|
||||
from model.largefiles import asset_name, load_registered_paths, published_asset_name
|
||||
from packs.extras import (
|
||||
_detect_extras_prefix,
|
||||
_extra_system_ids,
|
||||
detect_extras_prefix,
|
||||
extra_system_ids,
|
||||
extra_full_destination,
|
||||
extra_region_key,
|
||||
save_manifest_dest,
|
||||
@@ -124,7 +124,7 @@ def _stable_hashes(local_path: str, db: dict) -> dict:
|
||||
)
|
||||
|
||||
|
||||
def _manifest_entry(
|
||||
def manifest_entry(
|
||||
local_path: str | None,
|
||||
dest: str,
|
||||
cores: list[str] | None,
|
||||
@@ -192,7 +192,7 @@ def _is_program(path: str) -> bool:
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class _ClaimContext:
|
||||
class ClaimContext:
|
||||
"""How a manifest resolves and judges the copy a core claim names."""
|
||||
|
||||
db: dict
|
||||
@@ -206,10 +206,10 @@ class _ClaimContext:
|
||||
data_registry: dict | None = None
|
||||
|
||||
|
||||
def _attach_claims(
|
||||
def attach_claims(
|
||||
entry: dict,
|
||||
claims: list[dict],
|
||||
ctx: _ClaimContext,
|
||||
ctx: ClaimContext,
|
||||
dest: str,
|
||||
manifest_dest: str,
|
||||
) -> None:
|
||||
@@ -248,7 +248,7 @@ def _attach_claims(
|
||||
claim, claim_path, ctx.db, ctx.validation_index or {}, ctx.bios_dir, None,
|
||||
claim.get("layout_path") or dest, ctx.owners,
|
||||
)
|
||||
copy, _size = _manifest_entry(
|
||||
copy, _size = manifest_entry(
|
||||
claim_path, manifest_dest, [claim_emu], ctx.db, ctx.repo_root, {}
|
||||
)
|
||||
if copy is None:
|
||||
@@ -267,7 +267,7 @@ def _attach_claims(
|
||||
|
||||
def _absent_claim(claim: dict, claim_emu: str, claim_status: str) -> dict:
|
||||
"""The omission a claim with nothing held stands for."""
|
||||
systems = _extra_system_ids(claim)
|
||||
systems = extra_system_ids(claim)
|
||||
return {
|
||||
"name": str(claim.get("name") or ""),
|
||||
"system": systems[0] if systems else "",
|
||||
@@ -281,7 +281,7 @@ def _absent_claim(claim: dict, claim_emu: str, claim_status: str) -> dict:
|
||||
}
|
||||
|
||||
|
||||
def _record_slot_choices(
|
||||
def record_slot_choices(
|
||||
entry: dict,
|
||||
choices: list[tuple[str, str | None]],
|
||||
declarations: list[tuple[list[str], dict, str]],
|
||||
@@ -303,7 +303,7 @@ def _record_slot_choices(
|
||||
local_path, _status = settle(file_entry, sys_id, dest, override)
|
||||
if local_path is None:
|
||||
return None
|
||||
copy, _size = _manifest_entry(local_path, dest, None, db, repo_root, {})
|
||||
copy, _size = manifest_entry(local_path, dest, None, db, repo_root, {})
|
||||
if copy is None:
|
||||
return None
|
||||
return {k: v for k, v in copy.items() if k not in ("dest", "cores")}
|
||||
@@ -341,14 +341,14 @@ def _record_slot_choices(
|
||||
entry["declared_choices"] = declared
|
||||
|
||||
|
||||
def _manifest_dest_of(full_dest: str, base_dest: str) -> str:
|
||||
def manifest_dest_of(full_dest: str, base_dest: str) -> str:
|
||||
"""A pack destination as the manifest writes it, below base_destination."""
|
||||
if base_dest and full_dest.startswith(f"{base_dest}/"):
|
||||
return full_dest[len(base_dest) + 1:]
|
||||
return full_dest
|
||||
|
||||
|
||||
def _claim_platform_omission(held: dict | None, emulator: str) -> bool:
|
||||
def claim_platform_omission(held: dict | None, emulator: str) -> bool:
|
||||
"""Record a core's claim on a destination the platform already omits.
|
||||
|
||||
The platform's own omission stands while one of its declaring systems
|
||||
@@ -365,7 +365,7 @@ def _claim_platform_omission(held: dict | None, emulator: str) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
def _claim_cores(fe: dict) -> list[str]:
|
||||
def claim_cores(fe: dict) -> list[str]:
|
||||
"""The cores an extra and the claims folded onto it name: an omission
|
||||
names every core reading the file, as a list built for one of them
|
||||
would."""
|
||||
@@ -376,7 +376,7 @@ def _claim_cores(fe: dict) -> list[str]:
|
||||
return sorted(name for name in names if name)
|
||||
|
||||
|
||||
def _record_absent(
|
||||
def record_absent(
|
||||
absent: list[dict],
|
||||
config: dict,
|
||||
base_dest: str,
|
||||
@@ -392,7 +392,7 @@ def _record_absent(
|
||||
pak000-004 reached no safety notice: the installer said everything
|
||||
was verified and the game refused to start.
|
||||
"""
|
||||
extras_pfx = _detect_extras_prefix(config, base_dest)
|
||||
extras_pfx = detect_extras_prefix(config, base_dest)
|
||||
for fe in absent:
|
||||
if required_only and fe.get("required") is False:
|
||||
continue
|
||||
@@ -414,7 +414,7 @@ def _record_absent(
|
||||
and source_emu not in claimed):
|
||||
held["cores"] = sorted([*claimed, source_emu])
|
||||
continue
|
||||
systems = _extra_system_ids(fe)
|
||||
systems = extra_system_ids(fe)
|
||||
record_omission(
|
||||
full_dest, fe, systems[0] if systems else "", "not_found",
|
||||
[source_emu] if source_emu else [],
|
||||
@@ -429,7 +429,7 @@ def _record_absent(
|
||||
MANIFEST_OUTER_FIELDS = ("bios_folder", "from_bios", "searched", "default", "config")
|
||||
|
||||
|
||||
def _record_unplaceable(
|
||||
def record_unplaceable(
|
||||
unplaceable: list[dict],
|
||||
record_omission: Callable[..., None],
|
||||
config: dict,
|
||||
|
||||
@@ -19,11 +19,11 @@ from dataclasses import dataclass
|
||||
|
||||
from resolve import regions as resolve_regions
|
||||
from resolve import slot as slot_mod
|
||||
from model.systems import _norm_system_id
|
||||
from model.systems import norm_system_id
|
||||
from core.paths import declared_destination
|
||||
from packs.extras import (
|
||||
_kept,
|
||||
_serving_system_ids,
|
||||
kept_entries,
|
||||
serving_system_ids,
|
||||
extra_region_groups,
|
||||
extra_region_key,
|
||||
system_spellings,
|
||||
@@ -54,11 +54,11 @@ class SelectionIndex:
|
||||
) -> SelectionIndex:
|
||||
by_norm: dict[str, set[str]] = {}
|
||||
for sys_id in pack_systems:
|
||||
by_norm.setdefault(_norm_system_id(sys_id), set()).add(sys_id)
|
||||
by_norm.setdefault(norm_system_id(sys_id), set()).add(sys_id)
|
||||
|
||||
declared_by: dict[str, set[str]] = {}
|
||||
for sys_id, system in pack_systems.items():
|
||||
for file_entry in _kept(system.get("files", []), required_only):
|
||||
for file_entry in kept_entries(system.get("files", []), required_only):
|
||||
dest = declared_destination(file_entry)
|
||||
if dest:
|
||||
declared_by.setdefault(dest, set()).add(sys_id)
|
||||
@@ -76,9 +76,9 @@ class SelectionIndex:
|
||||
)
|
||||
# A profile system the platform does not have is no system the
|
||||
# pack's --system accepts: it would offer what the pack refuses.
|
||||
for sys_id in _serving_system_ids(extra):
|
||||
for sys_id in serving_system_ids(extra):
|
||||
owned_by.setdefault(dest, set()).update(
|
||||
by_norm.get(_norm_system_id(sys_id), ())
|
||||
by_norm.get(norm_system_id(sys_id), ())
|
||||
)
|
||||
|
||||
systems_by_dest = {
|
||||
|
||||
@@ -11,9 +11,9 @@ from typing import TYPE_CHECKING, TypedDict
|
||||
from core.options import reject_unknown
|
||||
from model.platforms import load_platform_config
|
||||
from model.profiles import ProfileSelectionError, load_emulator_profiles, select_emulator_profiles
|
||||
from packs.archive import _add_pack_member, _writing_pack
|
||||
from packs.naming import _name_part, _narrowings
|
||||
from packs.paths import _resolve_destination
|
||||
from packs.archive import add_pack_member, writing_pack
|
||||
from packs.naming import file_name_part, pack_narrowings
|
||||
from packs.paths import resolve_destination
|
||||
from resolve.packfiles import resolve_file, sha1_for_hash
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -134,7 +134,7 @@ def _md5_pack_name(
|
||||
# take the name of a run without it.
|
||||
custom_tags = "".join(
|
||||
tag
|
||||
for tag, _label in _narrowings(
|
||||
for tag, _label in pack_narrowings(
|
||||
"full", None, None, False, False, standalone=opts.standalone
|
||||
)
|
||||
)
|
||||
@@ -144,7 +144,7 @@ def _md5_pack_name(
|
||||
"\n".join(sorted(f"{kind}:{value.lower()}" for kind, value in hashes)).encode()
|
||||
).hexdigest()[:8]
|
||||
return (
|
||||
f"{_name_part(context_name, '_')}{mode_part}_Custom_{selection}{custom_tags}"
|
||||
f"{file_name_part(context_name, '_')}{mode_part}_Custom_{selection}{custom_tags}"
|
||||
"_BIOS_Pack.zip"
|
||||
)
|
||||
|
||||
@@ -166,7 +166,7 @@ def _md5_destination(entry: dict, layout: _Md5Layout, opts: _Md5Settings) -> str
|
||||
if opts.emulator_name:
|
||||
# Laid out as the emulator pack lays it out: its path and
|
||||
# its standalone_path, which --standalone has to reach.
|
||||
dest = _resolve_destination(matched_fe, opts.standalone)
|
||||
dest = resolve_destination(matched_fe, opts.standalone)
|
||||
else:
|
||||
dest = matched_fe.get("destination", matched_fe.get("name", name))
|
||||
elif paths:
|
||||
@@ -202,7 +202,7 @@ def generate_md5_pack(
|
||||
not_in_db: list[str] = []
|
||||
seen: set[str] = set()
|
||||
|
||||
with _writing_pack(zip_path) as zf:
|
||||
with writing_pack(zip_path) as zf:
|
||||
for hash_type, hash_val in hashes:
|
||||
sha1 = sha1_for_hash(hash_type, hash_val, db)
|
||||
if not sha1:
|
||||
@@ -225,7 +225,7 @@ def generate_md5_pack(
|
||||
not_in_repo.append((name, hash_val))
|
||||
continue
|
||||
|
||||
_add_pack_member(zf, local_path, full_dest)
|
||||
add_pack_member(zf, local_path, full_dest)
|
||||
packed.append((name, hash_val))
|
||||
|
||||
total = len(hashes)
|
||||
|
||||
+25
-25
@@ -15,7 +15,7 @@ from packs import parts as packs_parts
|
||||
from resolve.grouping import group_identical_platforms
|
||||
|
||||
|
||||
def _narrowings(
|
||||
def pack_narrowings(
|
||||
source: str,
|
||||
regions: list[str] | None,
|
||||
target_name: str | None,
|
||||
@@ -69,7 +69,7 @@ def _target_tag(target_name: str) -> str:
|
||||
)
|
||||
|
||||
|
||||
def _platform_target(
|
||||
def platform_target(
|
||||
platform_name: str, target: str | None, platforms_dir: str
|
||||
) -> str | None:
|
||||
"""The target as this platform files it, the name its artifacts carry.
|
||||
@@ -86,7 +86,7 @@ def _platform_target(
|
||||
return canonical_target_name([platform_name], target, platforms_dir)
|
||||
|
||||
|
||||
def _system_tag(system_filter: list[str] | None) -> str:
|
||||
def system_tag(system_filter: list[str] | None) -> str:
|
||||
"""Filename tag for a pack limited to some systems, empty for all."""
|
||||
if not system_filter:
|
||||
return ""
|
||||
@@ -98,7 +98,7 @@ def _system_tag(system_filter: list[str] | None) -> str:
|
||||
s = s[len(prefix) :]
|
||||
break
|
||||
display_parts.append("_".join(p.title() for p in s.split("-") if p))
|
||||
return "_" + _bounded_join(display_parts, system_filter)
|
||||
return "_" + bounded_join(display_parts, system_filter)
|
||||
|
||||
|
||||
# A system list long enough to push a pack name past this falls back to the
|
||||
@@ -106,7 +106,7 @@ def _system_tag(system_filter: list[str] | None) -> str:
|
||||
MAX_SYSTEM_TAG_BYTES = 120
|
||||
|
||||
|
||||
def _bounded_join(parts: list[str], keys: list[str]) -> str:
|
||||
def bounded_join(parts: list[str], keys: list[str]) -> str:
|
||||
"""Parts joined while they fit, else the first, a count and a digest.
|
||||
|
||||
Thirty systems joined made a 261-byte file name and the ZIP could not
|
||||
@@ -125,7 +125,7 @@ def _bounded_join(parts: list[str], keys: list[str]) -> str:
|
||||
_UNSAFE_IN_NAME = re.compile(r'[/\\:*?"<>|]')
|
||||
|
||||
|
||||
def _name_part(text: str, space: str = "") -> str:
|
||||
def file_name_part(text: str, space: str = "") -> str:
|
||||
"""A display name made safe to stand in a file name.
|
||||
|
||||
'FinalBurn Neo (CPS-1/CPS-2)' named a directory that did not exist, and a
|
||||
@@ -134,7 +134,7 @@ def _name_part(text: str, space: str = "") -> str:
|
||||
return _UNSAFE_IN_NAME.sub("-", text.replace(" ", space))
|
||||
|
||||
|
||||
def _platform_pack_stem(
|
||||
def platform_pack_stem(
|
||||
group_platforms: list[str], representative: str, platforms_dir: str
|
||||
) -> str:
|
||||
"""Platform part of a pack name, version included.
|
||||
@@ -144,7 +144,7 @@ def _platform_pack_stem(
|
||||
"""
|
||||
rep_cfg = load_platform_config(representative, platforms_dir)
|
||||
version = rep_cfg.get("version", rep_cfg.get("dat_version", ""))
|
||||
version_tag = f"_{_name_part(str(version))}" if version else ""
|
||||
version_tag = f"_{file_name_part(str(version))}" if version else ""
|
||||
return platform_pack_prefix(group_platforms, representative, platforms_dir) + version_tag
|
||||
|
||||
|
||||
@@ -158,15 +158,15 @@ def platform_pack_prefix(
|
||||
"""
|
||||
if len(group_platforms) <= 1:
|
||||
rep_cfg = load_platform_config(representative, platforms_dir)
|
||||
return _name_part(rep_cfg.get("platform", representative), "_")
|
||||
return file_name_part(rep_cfg.get("platform", representative), "_")
|
||||
names = [
|
||||
load_platform_config(p, platforms_dir).get("platform", p)
|
||||
for p in group_platforms
|
||||
]
|
||||
return "_".join(_name_part(n) for n in names)
|
||||
return "_".join(file_name_part(n) for n in names)
|
||||
|
||||
|
||||
def _platform_pack_name(
|
||||
def platform_pack_name(
|
||||
platform_name: str,
|
||||
platforms_dir: str,
|
||||
narrowings: list[tuple[str, str]],
|
||||
@@ -179,9 +179,9 @@ def _platform_pack_name(
|
||||
"""
|
||||
if pack_name:
|
||||
return pack_name
|
||||
stem = _platform_pack_stem([platform_name], platform_name, platforms_dir)
|
||||
stem = platform_pack_stem([platform_name], platform_name, platforms_dir)
|
||||
tags = "".join(tag for tag, _label in narrowings)
|
||||
return f"{stem}{tags}_BIOS_Pack{_system_tag(system_filter)}.zip"
|
||||
return f"{stem}{tags}_BIOS_Pack{system_tag(system_filter)}.zip"
|
||||
|
||||
|
||||
# A file name holds 255 bytes on every filesystem a pack is written to,
|
||||
@@ -189,7 +189,7 @@ def _platform_pack_name(
|
||||
MAX_PACK_NAME_BYTES = 200
|
||||
|
||||
|
||||
def _bounded_pack_name(display_names: list[str], keys: list[str], suffix: str) -> str:
|
||||
def bounded_pack_name(display_names: list[str], keys: list[str], suffix: str) -> str:
|
||||
"""The emulator pack's file name, its emulators joined while they fit.
|
||||
|
||||
Past the limit the name keeps the first emulator, says how many more the
|
||||
@@ -203,7 +203,7 @@ def _bounded_pack_name(display_names: list[str], keys: list[str], suffix: str) -
|
||||
return f"{display_names[0]}_and_{len(display_names) - 1}_more_{digest}{suffix}"
|
||||
|
||||
|
||||
def _expected_pack_names(
|
||||
def expected_pack_names(
|
||||
platforms: list[str],
|
||||
platforms_dir: str,
|
||||
regions: list[str] | None,
|
||||
@@ -220,11 +220,11 @@ def _expected_pack_names(
|
||||
the (source, required_only) combinations the run built.
|
||||
"""
|
||||
def narrow_tags(platform_name: str) -> list[str]:
|
||||
named = _platform_target(platform_name, target_name, platforms_dir)
|
||||
named = platform_target(platform_name, target_name, platforms_dir)
|
||||
return [
|
||||
"".join(
|
||||
tag
|
||||
for tag, _label in _narrowings(
|
||||
for tag, _label in pack_narrowings(
|
||||
source, regions, named, False, required, no_game_data=no_game_data
|
||||
)
|
||||
)
|
||||
@@ -233,7 +233,7 @@ def _expected_pack_names(
|
||||
|
||||
names: dict[str, set[str]] = {
|
||||
p: {
|
||||
f"{_platform_pack_stem([p], p, platforms_dir)}{tags}_BIOS_Pack.zip"
|
||||
f"{platform_pack_stem([p], p, platforms_dir)}{tags}_BIOS_Pack.zip"
|
||||
for tags in narrow_tags(p)
|
||||
}
|
||||
for p in platforms
|
||||
@@ -255,7 +255,7 @@ def _expected_pack_names(
|
||||
):
|
||||
if len(group) < 2:
|
||||
continue
|
||||
stem = _platform_pack_stem(group, representative, platforms_dir)
|
||||
stem = platform_pack_stem(group, representative, platforms_dir)
|
||||
for tags in narrow_tags(representative):
|
||||
for p in group:
|
||||
if p in names:
|
||||
@@ -281,7 +281,7 @@ def _content_narrowing_tags() -> tuple[str, ...]:
|
||||
for source, one_per_slot, required_only in dimensions:
|
||||
tags.extend(
|
||||
tag
|
||||
for tag, _label in _narrowings(source, None, None, one_per_slot, required_only)
|
||||
for tag, _label in pack_narrowings(source, None, None, one_per_slot, required_only)
|
||||
)
|
||||
return tuple(tags)
|
||||
|
||||
@@ -289,7 +289,7 @@ def _content_narrowing_tags() -> tuple[str, ...]:
|
||||
_CONTENT_NARROWING_TAGS = _content_narrowing_tags()
|
||||
|
||||
|
||||
def _narrows_contents(pack_name: str) -> bool:
|
||||
def narrows_contents(pack_name: str) -> bool:
|
||||
"""True when a pack holds fewer files than the platform declares.
|
||||
|
||||
A source-restricted or required-only build is narrower by design, so the
|
||||
@@ -300,15 +300,15 @@ def _narrows_contents(pack_name: str) -> bool:
|
||||
return any(f"{tag}_" in pack_name for tag in _CONTENT_NARROWING_TAGS)
|
||||
|
||||
|
||||
def _pack_variant(pack_name: str) -> tuple[str, bool] | None:
|
||||
def pack_variant(pack_name: str) -> tuple[str, bool] | None:
|
||||
"""The (source, required_only) a pack was built as, read from its name.
|
||||
|
||||
None for a one-per-slot pack, whose slot choice the check does not
|
||||
replay. The tags come from the name builder, as for _narrows_contents.
|
||||
replay. The tags come from the name builder, as for narrows_contents.
|
||||
"""
|
||||
def tagged(**dimension: object) -> bool:
|
||||
tags = [
|
||||
tag for tag, _label in _narrowings(
|
||||
tag for tag, _label in pack_narrowings(
|
||||
str(dimension.get("source", "full")), None, None,
|
||||
bool(dimension.get("one_per_slot", False)),
|
||||
bool(dimension.get("required_only", False)),
|
||||
@@ -324,7 +324,7 @@ def _pack_variant(pack_name: str) -> tuple[str, bool] | None:
|
||||
return source, tagged(required_only=True)
|
||||
|
||||
|
||||
def _pack_archives(output_dir: str) -> list[str]:
|
||||
def pack_archives(output_dir: str) -> list[str]:
|
||||
"""The ZIPs of a directory that are packs.
|
||||
|
||||
A part of a split pack holds a share of a platform by design and was
|
||||
|
||||
@@ -151,7 +151,7 @@ def _path_parents(dest: str) -> list[str]:
|
||||
parts = dest.split("/")
|
||||
return ["/".join(parts[:i]) for i in range(1, len(parts))]
|
||||
|
||||
def _has_path_conflict(dest: str, seen_files: set[str], seen_parents: set[str]) -> bool:
|
||||
def has_path_conflict(dest: str, seen_files: set[str], seen_parents: set[str]) -> bool:
|
||||
"""Check if dest conflicts with existing paths (file vs directory).
|
||||
|
||||
Returns True if adding dest would create an impossible extraction:
|
||||
@@ -179,12 +179,12 @@ def placement_block(
|
||||
return "taken"
|
||||
if case_insensitive and dest.lower() in seen_lower:
|
||||
return "case_twin"
|
||||
if _has_path_conflict(dest, seen_files, seen_parents):
|
||||
if has_path_conflict(dest, seen_files, seen_parents):
|
||||
return "path_conflict"
|
||||
return None
|
||||
|
||||
|
||||
def _register_path(dest: str, seen_files: set[str], seen_parents: set[str]) -> None:
|
||||
def register_path(dest: str, seen_files: set[str], seen_parents: set[str]) -> None:
|
||||
"""Track a file path and its parent directories."""
|
||||
seen_files.add(dest)
|
||||
for parent in _path_parents(dest):
|
||||
@@ -207,13 +207,13 @@ def lands_on_android(target_names: Iterable[str], target: str | None) -> bool:
|
||||
return any(name.startswith("android") for name in target_names)
|
||||
|
||||
|
||||
def _flat(arcname: str, prefix: str, flatten: bool) -> str:
|
||||
def flat_arcname(arcname: str, prefix: str, flatten: bool) -> str:
|
||||
"""Strip base_destination prefix from ZIP arcname when flattening."""
|
||||
if flatten and prefix and arcname.startswith(prefix + "/"):
|
||||
return arcname[len(prefix) + 1:]
|
||||
return arcname
|
||||
|
||||
def _resolve_destination(file_entry: dict, standalone: bool) -> str:
|
||||
def resolve_destination(file_entry: dict, standalone: bool) -> str:
|
||||
"""Resolve the ZIP destination path for a file entry.
|
||||
|
||||
``path:`` is where the libretro build reads the file from the system
|
||||
@@ -241,7 +241,7 @@ def _resolve_destination(file_entry: dict, standalone: bool) -> str:
|
||||
return dest
|
||||
|
||||
|
||||
def _archive_destination(
|
||||
def archive_destination(
|
||||
archive_name: str, archive_prefix: str, pack_structure: dict | None, standalone: bool
|
||||
) -> str:
|
||||
"""Where an emulator pack places one of the profile's archives."""
|
||||
|
||||
@@ -24,29 +24,29 @@ from packs import slots
|
||||
from packs.archive import (
|
||||
CASE_FOLDING_OS,
|
||||
PackRecord,
|
||||
_Placed,
|
||||
_add_pack_member,
|
||||
_add_zip_to_pack,
|
||||
_extract_zip_to_archive,
|
||||
_same_bytes,
|
||||
_write_generated_member,
|
||||
_writing_pack,
|
||||
Placed,
|
||||
add_pack_member,
|
||||
add_zip_to_pack,
|
||||
extract_zip_to_archive,
|
||||
same_bytes,
|
||||
write_generated_member,
|
||||
writing_pack,
|
||||
)
|
||||
from packs.datatrees import _data_directory_members, core_data_trees, pack_markers
|
||||
from packs.emulatorpack import _system_display_name
|
||||
from packs.datatrees import data_directory_members, core_data_trees, pack_markers
|
||||
from packs.emulatorpack import system_display_name
|
||||
from packs.extras import (
|
||||
ExtraResolver,
|
||||
_collect_emulator_extras,
|
||||
_detect_extras_prefix,
|
||||
collect_emulator_extras,
|
||||
detect_extras_prefix,
|
||||
extra_full_destination,
|
||||
extra_region_key,
|
||||
extras_for_systems as _extras_for_systems,
|
||||
platform_region_groups,
|
||||
undeclared_report,
|
||||
)
|
||||
from packs.naming import _name_part, _narrowings, _platform_pack_name, _platform_pack_stem
|
||||
from packs.paths import _flat, save_layout
|
||||
from packs.readme import _build_agnostic_rename_readme, _build_readme, save_place
|
||||
from packs.naming import file_name_part, pack_narrowings, platform_pack_name, platform_pack_stem
|
||||
from packs.paths import flat_arcname, save_layout
|
||||
from packs.readme import build_agnostic_rename_readme, build_readme, save_place
|
||||
from resolve import packfiles as packresolve, regions as resolve_regions, slot as slot_mod
|
||||
from resolve.contentlayout import TARGET_KEY
|
||||
from resolve.cores import platform_scope_systems, system_scope_error
|
||||
@@ -59,8 +59,8 @@ from resolve.packfiles import (
|
||||
resolve_file,
|
||||
)
|
||||
from resolve.validation import (
|
||||
_build_validation_index,
|
||||
_parse_validation,
|
||||
build_validation_index,
|
||||
parse_validation,
|
||||
agnostic_substitute,
|
||||
baseline_verdict,
|
||||
destination_owners,
|
||||
@@ -78,7 +78,7 @@ def _case_twin_pairs(
|
||||
) -> list[tuple[str, str]]:
|
||||
"""Each spelling left out, with the spelling the pack holds."""
|
||||
held = {
|
||||
_flat(dest, base_dest, flatten).lower(): _flat(dest, base_dest, flatten)
|
||||
flat_arcname(dest, base_dest, flatten).lower(): flat_arcname(dest, base_dest, flatten)
|
||||
for dest in seen_destinations
|
||||
}
|
||||
return sorted({(twin, held[twin.lower()]) for twin in twins if twin.lower() in held})
|
||||
@@ -201,7 +201,7 @@ def _select_variants(
|
||||
|
||||
slot_undecidable: list[str] = []
|
||||
if one_per_slot:
|
||||
slot_drops, slot_undecidable = _slot_drops(
|
||||
slot_drops, slot_undecidable = one_per_slot_drops(
|
||||
config, emu_profiles, target_cores, region_groups, region_drops, held
|
||||
)
|
||||
region_drops = region_drops | slot_drops
|
||||
@@ -214,7 +214,7 @@ def _select_variants(
|
||||
return region_drops, region_fallbacks, slot_undecidable
|
||||
|
||||
|
||||
def _slot_drops(
|
||||
def one_per_slot_drops(
|
||||
config: dict,
|
||||
emu_profiles: dict | None,
|
||||
target_cores: set[str] | None,
|
||||
@@ -247,7 +247,7 @@ def _matches_an_alternative(fe: dict, local_path: str, profiles: dict) -> bool:
|
||||
return False
|
||||
# A sibling the code takes without a check (Raze's "BLOOD: Unknown
|
||||
# Version") accepts whatever copy fills the slot.
|
||||
if any(not _parse_validation(entry.get("validation")) for entry in siblings):
|
||||
if any(not parse_validation(entry.get("validation")) for entry in siblings):
|
||||
return True
|
||||
actual = compute_hashes(local_path, frozenset({"sha1", "md5", "crc32"}))
|
||||
for entry in siblings:
|
||||
@@ -408,13 +408,13 @@ def _plan_platform_pack(
|
||||
if cut is not None:
|
||||
config, emu_profiles = cut.config, cut.profiles
|
||||
|
||||
narrowings = _narrowings(
|
||||
narrowings = pack_narrowings(
|
||||
opts.source, opts.regions, opts.target_name, opts.one_per_slot, opts.required_only,
|
||||
no_game_data=opts.no_game_data,
|
||||
)
|
||||
zip_path = os.path.join(
|
||||
output_dir,
|
||||
_platform_pack_name(
|
||||
platform_pack_name(
|
||||
platform_name, platforms_dir, narrowings, opts.system_filter, opts.pack_name
|
||||
),
|
||||
)
|
||||
@@ -432,7 +432,7 @@ def _plan_platform_pack(
|
||||
name: emu_profiles[name]
|
||||
for name in resolve_platform_cores(config, emu_profiles)
|
||||
}
|
||||
validation_index = _build_validation_index(platform_profiles)
|
||||
validation_index = build_validation_index(platform_profiles)
|
||||
validation_owners = destination_owners(platform_profiles)
|
||||
slot_overrides = slots.pack_overrides(
|
||||
config, emu_profiles or {}, db, zip_contents, opts.data_registry,
|
||||
@@ -515,7 +515,7 @@ class _PlatformPackBuild:
|
||||
verdict: Callable[[dict, str | None, str], tuple[str, str | None]]
|
||||
judge: Callable[[dict, str | None, str], tuple[str | None, str | None]]
|
||||
resolve_extra: Callable[[dict, str], tuple[str | None, str, str]]
|
||||
placed: _Placed = field(init=False)
|
||||
placed: Placed = field(init=False)
|
||||
total_files: int = 0
|
||||
core_count: int = 0
|
||||
save_count: int = 0
|
||||
@@ -532,10 +532,10 @@ class _PlatformPackBuild:
|
||||
case_twins: list[str] = field(default_factory=list)
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
self.placed = _Placed(self.plan.case_insensitive)
|
||||
self.placed = Placed(self.plan.case_insensitive)
|
||||
|
||||
def _flat(self, path: str) -> str:
|
||||
return _flat(path, self.plan.base_dest, self.plan.opts.flatten)
|
||||
return flat_arcname(path, self.plan.base_dest, self.plan.opts.flatten)
|
||||
|
||||
def run(self) -> None:
|
||||
if self.plan.opts.source != "truth":
|
||||
@@ -642,7 +642,7 @@ class _PlatformPackBuild:
|
||||
instr_path = (
|
||||
f"{base_dest}/{instr_name}" if base_dest else instr_name
|
||||
)
|
||||
_write_generated_member(
|
||||
write_generated_member(
|
||||
self.zf,
|
||||
self._flat(instr_path),
|
||||
f"File needed: {file_entry['name']}\n\n{instructions}\n",
|
||||
@@ -664,9 +664,9 @@ class _PlatformPackBuild:
|
||||
if self.plan.opts.record is None and download_external(file_entry, tmp_path):
|
||||
extract = file_entry.get("extract", False)
|
||||
if extract and tmp_path.endswith(".zip"):
|
||||
_extract_zip_to_archive(tmp_path, self._flat(full_dest), self.zf)
|
||||
extract_zip_to_archive(tmp_path, self._flat(full_dest), self.zf)
|
||||
else:
|
||||
_add_pack_member(self.zf, tmp_path, self._flat(full_dest))
|
||||
add_pack_member(self.zf, tmp_path, self._flat(full_dest))
|
||||
self.file_status.setdefault(full_dest, "ok")
|
||||
self.total_files += 1
|
||||
else:
|
||||
@@ -700,11 +700,11 @@ class _PlatformPackBuild:
|
||||
if entry.get("path", "").startswith(agnostic_path)
|
||||
and entry.get("name", "") and entry.get("name", "") != original_name
|
||||
]
|
||||
readme_text = _build_agnostic_rename_readme(dest_name, original_name, alt_names)
|
||||
readme_text = build_agnostic_rename_readme(dest_name, original_name, alt_names)
|
||||
readme_name = f"RENAMED_{dest_name}.txt"
|
||||
readme_full = f"{plan.base_dest}/{readme_name}" if plan.base_dest else readme_name
|
||||
if readme_full not in self.placed.destinations:
|
||||
_write_generated_member(self.zf, self._flat(readme_full), readme_text)
|
||||
write_generated_member(self.zf, self._flat(readme_full), readme_text)
|
||||
self.placed.destinations.add(readme_full)
|
||||
return local_path
|
||||
|
||||
@@ -766,7 +766,7 @@ class _PlatformPackBuild:
|
||||
if full_dest not in self.placed.destinations:
|
||||
self.case_twins.append(self._flat(full_dest))
|
||||
return
|
||||
if within is not None and not _same_bytes(local_path, within.get(self._flat(full_dest))):
|
||||
if within is not None and not same_bytes(local_path, within.get(self._flat(full_dest))):
|
||||
# The full pack holds another system's file here.
|
||||
return
|
||||
if self.file_status.get(full_dest) == "excluded":
|
||||
@@ -777,11 +777,11 @@ class _PlatformPackBuild:
|
||||
extract = file_entry.get("extract", False)
|
||||
flat_dest = self._flat(full_dest)
|
||||
if extract and local_path.endswith(".zip"):
|
||||
_extract_zip_to_archive(local_path, flat_dest, self.zf)
|
||||
extract_zip_to_archive(local_path, flat_dest, self.zf)
|
||||
elif local_path.endswith(".zip"):
|
||||
_add_zip_to_pack(local_path, flat_dest, self.zf, file_entry)
|
||||
add_zip_to_pack(local_path, flat_dest, self.zf, file_entry)
|
||||
else:
|
||||
_add_pack_member(self.zf, local_path, flat_dest)
|
||||
add_pack_member(self.zf, local_path, flat_dest)
|
||||
self.total_files += 1
|
||||
|
||||
def _region_dropped(self, fe: dict) -> bool:
|
||||
@@ -803,14 +803,14 @@ class _PlatformPackBuild:
|
||||
# The systems asked for, with what their cores need: the split
|
||||
# packs get exactly this, and a full pack of one system had none.
|
||||
return _extras_for_systems(
|
||||
_collect_emulator_extras(
|
||||
collect_emulator_extras(
|
||||
plan.config, opts.emulators_dir, plan.db, set(), plan.base_dest,
|
||||
plan.emu_profiles, target_cores=opts.target_cores,
|
||||
include_all=(opts.source == "truth"), undeclared=plan.undeclared,
|
||||
),
|
||||
opts.system_filter,
|
||||
)
|
||||
return _collect_emulator_extras(
|
||||
return collect_emulator_extras(
|
||||
plan.config,
|
||||
opts.emulators_dir,
|
||||
plan.db,
|
||||
@@ -842,13 +842,13 @@ class _PlatformPackBuild:
|
||||
# pack is extracted into the BIOS folder and cannot reach
|
||||
# them, the installer places these files.
|
||||
return
|
||||
# Core extras: _collect_emulator_extras already adjusted
|
||||
# Core extras: collect_emulator_extras already adjusted
|
||||
# destinations for slug-based platforms. Apply the effective
|
||||
# prefix (base_dest, or inferred from YAML when base_dest is
|
||||
# empty, as RetroDECK infers "bios"). A file read below the save
|
||||
# directory goes to the pack's save folder instead.
|
||||
full_dest = extra_full_destination(
|
||||
fe, _detect_extras_prefix(plan.config, plan.base_dest)
|
||||
fe, detect_extras_prefix(plan.config, plan.base_dest)
|
||||
)
|
||||
if not full_dest:
|
||||
return
|
||||
@@ -872,12 +872,12 @@ class _PlatformPackBuild:
|
||||
|
||||
flat_dest = self._flat(full_dest)
|
||||
within = plan.opts.within
|
||||
if within is not None and not _same_bytes(local_path, within.get(flat_dest)):
|
||||
if within is not None and not same_bytes(local_path, within.get(flat_dest)):
|
||||
return
|
||||
if local_path.endswith(".zip"):
|
||||
_add_zip_to_pack(local_path, flat_dest, self.zf, fe)
|
||||
add_zip_to_pack(local_path, flat_dest, self.zf, fe)
|
||||
else:
|
||||
_add_pack_member(self.zf, local_path, flat_dest)
|
||||
add_pack_member(self.zf, local_path, flat_dest)
|
||||
if self.file_status.get(full_dest) in ("missing", "excluded"):
|
||||
self._core_fills_declaration(fe, full_dest)
|
||||
self.placed.take(full_dest)
|
||||
@@ -952,13 +952,13 @@ class _PlatformPackBuild:
|
||||
required_only = plan.opts.required_only
|
||||
seen_parents = self.placed.parents
|
||||
added = 0
|
||||
for src, full in _data_directory_members(
|
||||
for src, full in data_directory_members(
|
||||
pack_systems, plan.opts.data_registry, plan.platform_name, plan.base_dest,
|
||||
self.placed.fold, self.placed.destinations, self.placed.lower,
|
||||
seen_parents, required_only=required_only,
|
||||
core_trees=core_trees,
|
||||
):
|
||||
_add_pack_member(self.zf, src, self._flat(full))
|
||||
add_pack_member(self.zf, src, self._flat(full))
|
||||
if isinstance(self.zf, PackRecord):
|
||||
self.zf.trees.append(self._flat(full))
|
||||
added += 1
|
||||
@@ -970,14 +970,14 @@ class _PlatformPackBuild:
|
||||
# them, as the manifest's case_variants are (Mesen-CE's bios.col
|
||||
# beside the declared BIOS.col).
|
||||
plan, opts = self.plan, self.plan.opts
|
||||
unfolded = _collect_emulator_extras(
|
||||
unfolded = collect_emulator_extras(
|
||||
{**plan.config, "case_insensitive_fs": False}, opts.emulators_dir, plan.db, set(),
|
||||
plan.base_dest, plan.emu_profiles, target_cores=opts.target_cores,
|
||||
include_all=(opts.source == "truth"),
|
||||
)
|
||||
if opts.system_filter:
|
||||
unfolded = _extras_for_systems(unfolded, opts.system_filter)
|
||||
prefix = _detect_extras_prefix(plan.config, plan.base_dest)
|
||||
prefix = detect_extras_prefix(plan.config, plan.base_dest)
|
||||
unfolded_spares = self._spares(unfolded)
|
||||
for fe in unfolded:
|
||||
if opts.required_only and (fe.get("required") is False or id(fe) in unfolded_spares):
|
||||
@@ -1004,7 +1004,7 @@ class _PlatformPackBuild:
|
||||
if keeps_case and opts.source != "platform" and opts.precomputed_extras is None:
|
||||
self._unfolded_twins()
|
||||
save_count = self.save_count
|
||||
readme_text = _build_readme(
|
||||
readme_text = build_readme(
|
||||
plan.platform_name, plan.platform_display, plan.base_dest, self.total_files,
|
||||
len(plan.pack_systems),
|
||||
source=opts.source,
|
||||
@@ -1033,9 +1033,9 @@ class _PlatformPackBuild:
|
||||
if keeps_case else []
|
||||
),
|
||||
)
|
||||
_write_generated_member(self.zf, "README.txt", readme_text)
|
||||
write_generated_member(self.zf, "README.txt", readme_text)
|
||||
for marker in pack_markers(plan.platform_name, opts.target_name, plan.platforms_dir):
|
||||
_write_generated_member(
|
||||
write_generated_member(
|
||||
self.zf,
|
||||
self._flat(f"{plan.base_dest}/{marker}" if plan.base_dest else marker),
|
||||
"",
|
||||
@@ -1136,7 +1136,7 @@ def generate_pack(
|
||||
|
||||
with (
|
||||
contextlib.nullcontext(opts.record) if opts.record is not None
|
||||
else _writing_pack(plan.zip_path)
|
||||
else writing_pack(plan.zip_path)
|
||||
) as zf:
|
||||
build = _PlatformPackBuild(plan, zf, resolve, verdict, judge, resolve_extra)
|
||||
build.run()
|
||||
@@ -1181,7 +1181,7 @@ def _split_extras(config: dict, db: dict, narrowing: PackNarrowing) -> list[dict
|
||||
if source == "platform":
|
||||
all_extras = []
|
||||
elif emu_profiles:
|
||||
all_extras = _collect_emulator_extras(
|
||||
all_extras = collect_emulator_extras(
|
||||
cut.config if cut else config, narrowing["emulators_dir"], db,
|
||||
set(), base_dest, cut.profiles if cut else emu_profiles,
|
||||
target_cores=target_cores, include_all=(source == "truth"),
|
||||
@@ -1229,7 +1229,7 @@ def generate_split_packs(
|
||||
# differently narrowed runs write into one another.
|
||||
split_tags = "".join(
|
||||
tag
|
||||
for tag, _label in _narrowings(
|
||||
for tag, _label in pack_narrowings(
|
||||
narrowing["source"], narrowing["regions"], narrowing["target_name"],
|
||||
narrowing["one_per_slot"], narrowing["required_only"],
|
||||
no_game_data=narrowing["no_game_data"],
|
||||
@@ -1244,7 +1244,7 @@ def generate_split_packs(
|
||||
# Named by the stem the full pack reads: assembled here by hand, a '/' in
|
||||
# a version nested the directory where the check never looked for it.
|
||||
part_prefix = (
|
||||
f"{_platform_pack_stem([platform_name], platform_name, platforms_dir)}{split_tags}"
|
||||
f"{platform_pack_stem([platform_name], platform_name, platforms_dir)}{split_tags}"
|
||||
)
|
||||
split_dir = os.path.join(output_dir, f"{part_prefix}{group_tag}_Split")
|
||||
if records is None:
|
||||
@@ -1278,14 +1278,14 @@ def generate_split_packs(
|
||||
if group_by == "manufacturer":
|
||||
groups = _group_systems_by_manufacturer(systems, db, bios_dir)
|
||||
else:
|
||||
groups = {_system_display_name(sid): [sid] for sid in systems}
|
||||
groups = {system_display_name(sid): [sid] for sid in systems}
|
||||
|
||||
all_extras = _split_extras(config, db, narrowing)
|
||||
results = []
|
||||
for group_name, group_system_ids in sorted(groups.items()):
|
||||
group_extras = _extras_for_systems(all_extras, group_system_ids)
|
||||
zip_path = part(
|
||||
f"{part_prefix}_{_name_part(group_name, '_')}_BIOS_Pack.zip",
|
||||
f"{part_prefix}_{file_name_part(group_name, '_')}_BIOS_Pack.zip",
|
||||
{"system_filter": group_system_ids, "precomputed_extras": group_extras},
|
||||
)
|
||||
if zip_path:
|
||||
|
||||
@@ -214,7 +214,7 @@ class ReadmeOptions(TypedDict, total=False):
|
||||
case_twins: list[tuple[str, str]] | None
|
||||
|
||||
|
||||
def _build_readme(
|
||||
def build_readme(
|
||||
platform_name: str,
|
||||
platform_display: str,
|
||||
base_dest: str,
|
||||
@@ -235,7 +235,7 @@ def _build_readme(
|
||||
where names keep their case (EmuDeck and RetroArch on Linux), where the
|
||||
core asking for the other spelling finds nothing.
|
||||
"""
|
||||
reject_unknown("_build_readme", options, ReadmeOptions.__optional_keys__)
|
||||
reject_unknown("build_readme", options, ReadmeOptions.__optional_keys__)
|
||||
regions = options.get("regions")
|
||||
launch_folders = options.get("launch_folders", 0)
|
||||
sep = "=" * 50
|
||||
@@ -366,7 +366,7 @@ def _region_info(regions: list[str] | None, fallback_systems: list[str] | None)
|
||||
" Only the best-matching BIOS was kept for each system.\n"
|
||||
)
|
||||
if fallback_systems:
|
||||
listed = "\n".join(f" {_group_label(s)}" for s in fallback_systems)
|
||||
listed = "\n".join(f" {group_label(s)}" for s in fallback_systems)
|
||||
region_info += (
|
||||
"\n These systems have no BIOS in those regions, so every\n"
|
||||
" BIOS file for them was kept:\n"
|
||||
@@ -426,7 +426,7 @@ def _credits(contributors: list[dict] | None) -> str:
|
||||
return credits + "\n"
|
||||
|
||||
|
||||
def _build_agnostic_rename_readme(
|
||||
def build_agnostic_rename_readme(
|
||||
destination: str,
|
||||
original: str,
|
||||
alternatives: list[str],
|
||||
@@ -445,7 +445,7 @@ def _build_agnostic_rename_readme(
|
||||
return "\n".join(lines) + "\n"
|
||||
|
||||
|
||||
def _group_label(group_id: str) -> str:
|
||||
def group_label(group_id: str) -> str:
|
||||
"""A region group as a reader names it: the system, or one core's slot."""
|
||||
emulator, kind, rest = (group_id.split(":", 2) + ["", ""])[:3]
|
||||
if kind == "variant" and rest:
|
||||
|
||||
+10
-10
@@ -55,7 +55,7 @@ def _print_ground_truth(gt: list[dict], verbose: bool) -> None:
|
||||
print(f" {_format_ground_truth_aggregate(gt)}")
|
||||
|
||||
|
||||
def _discrepancy_keys(details: list[dict]) -> set[str]:
|
||||
def discrepancy_keys(details: list[dict]) -> set[str]:
|
||||
"""The DISCREPANCY lines _print_detail_entries prints for these details.
|
||||
|
||||
A file already reported MISSING or UNTESTED on its own ground is not
|
||||
@@ -76,7 +76,7 @@ def _discrepancy_keys(details: list[dict]) -> set[str]:
|
||||
|
||||
|
||||
# A platform entry that is not firmware, as the report names it.
|
||||
_NOT_FIRMWARE = {
|
||||
NOT_FIRMWARE = {
|
||||
"game_data": "game data",
|
||||
"unread": "no core the platform runs opens it",
|
||||
}
|
||||
@@ -149,7 +149,7 @@ def _print_missing_details(details: list[dict], seen: set[str], verbose: bool) -
|
||||
key = f"{d['system']}/{d['name']}"
|
||||
if key in seen:
|
||||
continue
|
||||
label = _NOT_FIRMWARE.get(d.get("category", BIOS))
|
||||
label = NOT_FIRMWARE.get(d.get("category", BIOS))
|
||||
if label:
|
||||
# Counted on their own line, named on request.
|
||||
if verbose:
|
||||
@@ -228,7 +228,7 @@ def _print_undeclared_entry(
|
||||
print(f" validates {'+'.join(checks)}")
|
||||
|
||||
|
||||
def _split_undeclared(undeclared: list[dict]) -> tuple[list[dict], list[dict], list[dict]]:
|
||||
def split_undeclared(undeclared: list[dict]) -> tuple[list[dict], list[dict], list[dict]]:
|
||||
"""Game data, firmware the pack places, firmware it holds but cannot place.
|
||||
|
||||
Everything that is not game data is firmware the core loads, archives
|
||||
@@ -242,7 +242,7 @@ def _split_undeclared(undeclared: list[dict]) -> tuple[list[dict], list[dict], l
|
||||
return game_data, placed, unplaced
|
||||
|
||||
|
||||
def _core_required_missing(bios_files: list[dict]) -> list[dict]:
|
||||
def core_required_missing(bios_files: list[dict]) -> list[dict]:
|
||||
"""Core files a core cannot run without, absent from the collection.
|
||||
|
||||
A file bundled with the emulator (DaedalusX64's n64.psh, the shader
|
||||
@@ -287,7 +287,7 @@ def _print_undeclared_section(result: dict, verbose: bool) -> None:
|
||||
if not undeclared and not (packed and any(packed.values())):
|
||||
return
|
||||
|
||||
game_data, bios_files, unplaced = _split_undeclared(undeclared)
|
||||
game_data, bios_files, unplaced = split_undeclared(undeclared)
|
||||
|
||||
# A file installed with its emulator is never collected, firmware or
|
||||
# game data, required or not: cross_reference counts it apart. The
|
||||
@@ -296,7 +296,7 @@ def _print_undeclared_section(result: dict, verbose: bool) -> None:
|
||||
bundled = [u for u in undeclared if not u["in_repo"] and u.get("bundled")]
|
||||
game_data = [u for u in game_data if u["in_repo"] or not u.get("bundled")]
|
||||
|
||||
req_not_in_repo = _core_required_missing(bios_files)
|
||||
req_not_in_repo = core_required_missing(bios_files)
|
||||
req_hle_not_in_repo = [
|
||||
u
|
||||
for u in bios_files
|
||||
@@ -460,15 +460,15 @@ def _print_platform_notices(result: dict, verbose: bool) -> None:
|
||||
print(f" {line}")
|
||||
fallbacks = result.get("region_fallbacks") or []
|
||||
if fallbacks:
|
||||
from packs.readme import _group_label
|
||||
from packs.readme import group_label
|
||||
|
||||
print(f" No BIOS for the requested regions, all kept ({len(fallbacks)}): "
|
||||
+ ", ".join(_group_label(g) for g in fallbacks))
|
||||
+ ", ".join(group_label(g) for g in fallbacks))
|
||||
|
||||
not_firmware = result.get("missing_not_firmware") or {}
|
||||
if not_firmware:
|
||||
counts = ", ".join(
|
||||
f"{len(dests)} {_NOT_FIRMWARE[category]}"
|
||||
f"{len(dests)} {NOT_FIRMWARE[category]}"
|
||||
for category, dests in not_firmware.items()
|
||||
)
|
||||
listed = "" if verbose else " (--verbose lists them)"
|
||||
|
||||
+10
-10
@@ -10,7 +10,7 @@ from core.hashing import parse_md5_list
|
||||
from model.profiles import entry_system_ids
|
||||
from resolve import nativemode
|
||||
from resolve.archives import archive_entry, holds_required_members
|
||||
from resolve.collisions import _accepted_by_all, _content_sha1, _lists_hashes, _normalize
|
||||
from resolve.collisions import accepted_by_all, content_sha1, lists_hashes, comparable_destination
|
||||
from resolve.cores import resolve_platform_cores
|
||||
from resolve.layout import system_dir_path
|
||||
from resolve.localfile import resolution_is_hash_exact, resolve_local_file
|
||||
@@ -374,7 +374,7 @@ def _slot_claims(
|
||||
for claim in platform_claims(
|
||||
config, db, base_dest, zip_contents, data_dir_registry
|
||||
):
|
||||
key = _normalize(claim.destination, fold)
|
||||
key = comparable_destination(claim.destination, fold)
|
||||
held = by_dest.get(key)
|
||||
if held is not None and id(held.entry) in shipped:
|
||||
continue
|
||||
@@ -404,7 +404,7 @@ def _slot_claims(
|
||||
profiles, db, base_dest, standalone_cores, zip_contents, data_dir_registry,
|
||||
config=config,
|
||||
):
|
||||
key = _normalize(claim.destination, fold)
|
||||
key = comparable_destination(claim.destination, fold)
|
||||
platform = by_dest.get(key)
|
||||
if platform is None or not claim.is_proven:
|
||||
continue
|
||||
@@ -619,25 +619,25 @@ def _satisfies(profile: Claim, platform: Claim, db: dict) -> bool:
|
||||
# Two paths can hold one content: AmberELEC's bluemsx declarations
|
||||
# resolve into the data/bluemsx cache, the profile's into bios/.
|
||||
if profile.local_path and platform.local_path:
|
||||
shipped = _content_sha1(platform.local_path, db)
|
||||
if shipped is not None and shipped == _content_sha1(profile.local_path, db):
|
||||
shipped = content_sha1(platform.local_path, db)
|
||||
if shipped is not None and shipped == content_sha1(profile.local_path, db):
|
||||
return True
|
||||
members = profile.entry.get("members")
|
||||
if members and platform.local_path:
|
||||
return holds_required_members(platform.local_path, members)
|
||||
if (
|
||||
profile.local_path
|
||||
and _lists_hashes(platform.entry)
|
||||
and _accepted_by_all(profile.local_path, [platform.entry], db)
|
||||
and lists_hashes(platform.entry)
|
||||
and accepted_by_all(profile.local_path, [platform.entry], db)
|
||||
):
|
||||
return True
|
||||
if platform.local_path and any(
|
||||
_lists_hashes(label) and _accepted_by_all(platform.local_path, [label], db)
|
||||
lists_hashes(label) and accepted_by_all(platform.local_path, [label], db)
|
||||
for label in profile.accepts
|
||||
):
|
||||
return True
|
||||
return bool(
|
||||
platform.local_path
|
||||
and _lists_hashes(profile.entry)
|
||||
and _accepted_by_all(platform.local_path, [profile.entry], db)
|
||||
and lists_hashes(profile.entry)
|
||||
and accepted_by_all(platform.local_path, [profile.entry], db)
|
||||
)
|
||||
@@ -10,7 +10,7 @@ from pathlib import PurePosixPath
|
||||
from core.paths import REPO_ROOT
|
||||
from packs.archive import PackRecord
|
||||
from packs.emulatorpack import generate_emulator_pack
|
||||
from packs.manifestentry import _manifest_entry
|
||||
from packs.manifestentry import manifest_entry
|
||||
|
||||
|
||||
def _placed_copies(copies: list[dict], dests: list[str]) -> list[dict]:
|
||||
@@ -176,7 +176,7 @@ def _profile_copies(
|
||||
return copies
|
||||
|
||||
|
||||
def _standalone_copies(
|
||||
def standalone_copies(
|
||||
declared: list[dict], profiles: dict[str, dict], manifest_files: list[dict],
|
||||
) -> list[dict]:
|
||||
"""A manifest's standalone copies: the registry's, placed where this
|
||||
@@ -193,7 +193,7 @@ def _standalone_copies(
|
||||
STANDALONE_DIR = "standalone"
|
||||
|
||||
|
||||
def _standalone_layouts(
|
||||
def standalone_layouts(
|
||||
profiles: dict[str, dict],
|
||||
emulators_dir: str,
|
||||
db: dict,
|
||||
@@ -232,7 +232,7 @@ def _standalone_layouts(
|
||||
)
|
||||
items: list = []
|
||||
for member in record.files:
|
||||
entry, _size = _manifest_entry(
|
||||
entry, _size = manifest_entry(
|
||||
record.sources.get(member), member, [name], db, repo_root, {}
|
||||
)
|
||||
if entry is None:
|
||||
|
||||
@@ -40,8 +40,8 @@ class Severity:
|
||||
OK = "ok" # file verified
|
||||
|
||||
|
||||
_STATUS_ORDER = {Status.OK: 0, Status.UNTESTED: 1, Status.MISSING: 2}
|
||||
_SEVERITY_ORDER = {
|
||||
STATUS_ORDER = {Status.OK: 0, Status.UNTESTED: 1, Status.MISSING: 2}
|
||||
SEVERITY_ORDER = {
|
||||
Severity.OK: 0,
|
||||
Severity.INFO: 1,
|
||||
Severity.WARNING: 2,
|
||||
@@ -227,7 +227,7 @@ def verify_entry_sha1(
|
||||
# Severity mapping per platform
|
||||
|
||||
|
||||
def _emulator_severity(status: str, required: bool, hle_fallback: bool) -> str:
|
||||
def emulator_severity(status: str, required: bool, hle_fallback: bool) -> str:
|
||||
"""Severity when the emulator's own code is the check.
|
||||
|
||||
A file present but refused by the core's validation, or a different dump
|
||||
@@ -274,7 +274,7 @@ def compute_severity(
|
||||
return Severity.OK
|
||||
|
||||
|
||||
def _storage_verdict(file_entry: dict, emulator_pack: bool) -> dict | None:
|
||||
def storage_verdict(file_entry: dict, emulator_pack: bool) -> dict | None:
|
||||
"""The result a storage tier fixes before any lookup, as the builder sees it.
|
||||
|
||||
A user_provided entry is never taken from the collection: a platform pack
|
||||
|
||||
Reference in new issue
Block a user