mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-06 01:53:56 -06:00
fix: name the split directory by the pack stem
The prefix was assembled by hand and kept a '/' or ':' the full pack name makes safe (finding 17).
This commit is contained in:
1 parent
1718813728
commit
000877689f
2 files changed
+30
-4
No files matched your search
@@ -1919,7 +1919,6 @@ def generate_split_packs(
|
||||
) -> list[str]:
|
||||
"""Generate split packs (one ZIP per system or manufacturer)."""
|
||||
config = load_platform_config(platform_name, platforms_dir)
|
||||
platform_display = config.get("platform", platform_name)
|
||||
# The split directory carries the same tags as the packs inside it, or two
|
||||
# differently narrowed runs write into one another.
|
||||
split_tags = "".join(
|
||||
@@ -1935,9 +1934,11 @@ def generate_split_packs(
|
||||
# The parts carry the version, so the directory does too: a rescrape that
|
||||
# moves the version would otherwise leave the old parts beside the new
|
||||
# under one SHA256SUMS.txt.
|
||||
version = config.get("version", config.get("dat_version", ""))
|
||||
ver_tag = f"_{version.replace(' ', '')}" if version else ""
|
||||
part_prefix = f"{platform_display.replace(' ', '_')}{ver_tag}{split_tags}"
|
||||
# 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}"
|
||||
)
|
||||
split_dir = os.path.join(output_dir, f"{part_prefix}{group_tag}_Split")
|
||||
os.makedirs(split_dir, exist_ok=True)
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ out of a targeted --all run, and the check refuses it as the build does.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
import contextlib
|
||||
import io
|
||||
@@ -196,5 +197,29 @@ class APlatformWithoutTheSystemIsOutOfScope(unittest.TestCase):
|
||||
self.assertEqual(ctx.exception.code, 1)
|
||||
|
||||
|
||||
class TheSplitDirectoryReadsThePackStem(unittest.TestCase):
|
||||
"""The split prefix was assembled by hand: a version 'release/1.22' made
|
||||
'RetroArch_release/1.22_Split', a nested directory the check never
|
||||
found, beside a full pack named 'RetroArch_release-1.22_BIOS_Pack.zip'."""
|
||||
|
||||
def test_a_reserved_character_is_made_safe_as_in_the_full_pack(self):
|
||||
from unittest import mock
|
||||
|
||||
import generate_pack
|
||||
|
||||
config = {"platform": "Foo: Bar", "version": "release/1.22", "systems": {}}
|
||||
with tempfile.TemporaryDirectory(dir=REPO_ROOT / "tmp") as out, \
|
||||
mock.patch.object(generate_pack, "load_platform_config",
|
||||
return_value=config), \
|
||||
mock.patch.object(generate_pack, "_collect_emulator_extras",
|
||||
return_value=[]):
|
||||
generate_pack.generate_split_packs(
|
||||
"foo", "platforms", {"files": {}}, "bios", out, emu_profiles={},
|
||||
)
|
||||
stem = generate_pack._platform_pack_stem(["foo"], "foo", "platforms")
|
||||
self.assertEqual(os.listdir(out), [f"{stem}_Split"])
|
||||
self.assertEqual(stem, "Foo-_Bar_release-1.22")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user