mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-25 02:57:52 -06:00
refactor: define the pack suffix once
packs.parts held a second PACK_SUFFIX and five builders typed the literal; all read model.releaserecord.PACK_SUFFIX.
This commit is contained in:
1 parent
71b3d7db63
commit
f5946a7845
5 files changed
+11
-10
No files matched your search
@@ -26,6 +26,7 @@ from model.profiles import (
|
||||
select_emulator_profiles,
|
||||
)
|
||||
from model.registry import load_data_dir_registry
|
||||
from model.releaserecord import PACK_SUFFIX
|
||||
from packs.archive import (
|
||||
PackRecord,
|
||||
Placed,
|
||||
@@ -492,7 +493,7 @@ def generate_emulator_pack(
|
||||
)
|
||||
)
|
||||
zip_name = options.get("pack_name") or bounded_pack_name(
|
||||
display_names, [n for n, _p in selected], f"{narrow_tags}_BIOS_Pack.zip"
|
||||
display_names, [n for n, _p in selected], f"{narrow_tags}{PACK_SUFFIX}"
|
||||
)
|
||||
zip_path = os.path.join(output_dir, zip_name)
|
||||
if record is None:
|
||||
@@ -589,7 +590,7 @@ def generate_system_pack(
|
||||
# The selection mode is part of the name: `--system sega-triforce`
|
||||
# and `--emulator triforce` both wrote Triforce_BIOS_Pack.zip, and
|
||||
# the second run replaced the first without a word.
|
||||
final_name = f"{sys_display}_System{tags}_BIOS_Pack.zip"
|
||||
final_name = f"{sys_display}_System{tags}{PACK_SUFFIX}"
|
||||
scratch = tempfile.mkdtemp(prefix=".system-", dir=output_dir)
|
||||
try:
|
||||
result = generate_emulator_pack(
|
||||
|
||||
@@ -12,6 +12,7 @@ from core.hashing import parse_hash_list
|
||||
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 model.releaserecord import PACK_SUFFIX
|
||||
from packs.archive import add_pack_member, writing_pack
|
||||
from packs.naming import file_name_part, pack_narrowings
|
||||
from packs.paths import resolve_destination
|
||||
@@ -142,10 +143,7 @@ def _md5_pack_name(
|
||||
selection = hashlib.sha1(
|
||||
"\n".join(sorted(f"{kind}:{value.lower()}" for kind, value in hashes)).encode()
|
||||
).hexdigest()[:8]
|
||||
return (
|
||||
f"{file_name_part(context_name, '_')}{mode_part}_Custom_{selection}{custom_tags}"
|
||||
"_BIOS_Pack.zip"
|
||||
)
|
||||
return f"{file_name_part(context_name, '_')}{mode_part}_Custom_{selection}{custom_tags}{PACK_SUFFIX}"
|
||||
|
||||
|
||||
def _md5_destination(entry: dict, layout: _Md5Layout, opts: _Md5Settings) -> str:
|
||||
|
||||
@@ -9,11 +9,12 @@ import zipfile
|
||||
import zlib
|
||||
from pathlib import Path
|
||||
|
||||
from model.releaserecord import PACK_SUFFIX
|
||||
|
||||
|
||||
# "Each file included in a release must be under 2 GiB."
|
||||
ASSET_LIMIT = 2 * 1024**3
|
||||
|
||||
PACK_SUFFIX = "_BIOS_Pack.zip"
|
||||
_PART_NAME = re.compile(r"^(?P<stem>.+_BIOS_Pack)\.part(?P<index>\d+)of(?P<count>\d+)\.zip$")
|
||||
_MARKER_NAME = re.compile(r"^(?P<stem>.+_BIOS_Pack)\.part(?P<index>\d+)of(?P<count>\d+)\.txt$")
|
||||
# Sizes are written at a fixed width, so a marker's length, and with it the
|
||||
|
||||
@@ -19,6 +19,7 @@ from model.alternatives import core_file_spares
|
||||
from model.declarations import OUTER_ROOTS, declared_root
|
||||
from model.platforms import load_platform_config
|
||||
from model.profiles import load_emulator_profiles
|
||||
from model.releaserecord import PACK_SUFFIX
|
||||
from packs import slots
|
||||
from packs.archive import (
|
||||
CASE_FOLDING_OS,
|
||||
@@ -1278,7 +1279,7 @@ def generate_split_packs(
|
||||
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}_{file_name_part(group_name, '_')}_BIOS_Pack.zip",
|
||||
f"{part_prefix}_{file_name_part(group_name, '_')}{PACK_SUFFIX}",
|
||||
{"system_filter": group_system_ids, "precomputed_extras": group_extras},
|
||||
)
|
||||
if zip_path:
|
||||
@@ -1296,7 +1297,7 @@ def generate_split_packs(
|
||||
undistributed = [fe for fe in all_extras if id(fe) not in distributed]
|
||||
if undistributed:
|
||||
zip_path = part(
|
||||
f"{part_prefix}_Other_Cores_BIOS_Pack.zip",
|
||||
f"{part_prefix}_Other_Cores{PACK_SUFFIX}",
|
||||
{"precomputed_extras": undistributed, "extras_only": True},
|
||||
)
|
||||
if zip_path:
|
||||
|
||||
@@ -51,7 +51,7 @@ def _pack_version(pack_name: str, platforms: list[str]) -> str:
|
||||
"""
|
||||
from packs.naming import platform_pack_prefix
|
||||
|
||||
stem = pack_name.removesuffix("_BIOS_Pack.zip")
|
||||
stem = pack_name.removesuffix(releaserecord.PACK_SUFFIX)
|
||||
prefix = platform_pack_prefix(
|
||||
platforms, platforms[0], str(siteinputs.current().platforms)
|
||||
) + "_"
|
||||
|
||||
Reference in new issue
Block a user