mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-25 19:08:51 -06:00
refactor: name group packs with platform_pack_name
_group_pack_name and expected_pack_names assembled the stem, tags and suffix themselves; platform_pack_name now takes the group and is the one builder.
This commit is contained in:
1 parent
814f7b6bb9
commit
71b3d7db63
2 files changed
+21
-31
No files matched your search
+10
-18
@@ -95,9 +95,8 @@ from packs.naming import (
|
||||
expected_pack_names,
|
||||
pack_narrowings,
|
||||
pack_variant,
|
||||
platform_pack_stem,
|
||||
platform_pack_name,
|
||||
platform_target,
|
||||
system_tag,
|
||||
)
|
||||
from packs.platformpack import generate_pack
|
||||
from packs.scope import pack_systems, platform_list_version
|
||||
@@ -801,23 +800,16 @@ def _group_pack_name(
|
||||
) -> str:
|
||||
"""The file name of a pack shared by a group of identical platforms."""
|
||||
source, required_only = variant
|
||||
narrow_tags = "".join(
|
||||
tag
|
||||
for tag, _label in pack_narrowings(
|
||||
source,
|
||||
getattr(args, "regions", None),
|
||||
named_target,
|
||||
args.one_per_slot,
|
||||
required_only,
|
||||
no_game_data=getattr(args, "no_game_data", False),
|
||||
)
|
||||
narrowings = pack_narrowings(
|
||||
source,
|
||||
getattr(args, "regions", None),
|
||||
named_target,
|
||||
args.one_per_slot,
|
||||
required_only,
|
||||
no_game_data=getattr(args, "no_game_data", False),
|
||||
)
|
||||
stem = platform_pack_stem(
|
||||
group_platforms, representative, args.platforms_dir
|
||||
)
|
||||
return (
|
||||
f"{stem}{narrow_tags}_BIOS_Pack"
|
||||
f"{system_tag(system_filter)}.zip"
|
||||
return platform_pack_name(
|
||||
representative, args.platforms_dir, narrowings, system_filter, group=group_platforms
|
||||
)
|
||||
|
||||
|
||||
|
||||
+11
-13
@@ -175,14 +175,17 @@ def platform_pack_name(
|
||||
narrowings: list[tuple[str, str]],
|
||||
system_filter: list[str] | None,
|
||||
pack_name: str | None = None,
|
||||
group: list[str] | None = None,
|
||||
) -> str:
|
||||
"""File name of a platform pack: stem, narrowing tags, system tag.
|
||||
|
||||
A caller naming the pack itself (a --split part) is taken at its word.
|
||||
A pack shared by a group of identical platforms is named after the
|
||||
group, platform_name being its representative.
|
||||
"""
|
||||
if pack_name:
|
||||
return pack_name
|
||||
stem = platform_pack_stem([platform_name], platform_name, platforms_dir)
|
||||
stem = platform_pack_stem(group or [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"
|
||||
|
||||
@@ -222,22 +225,17 @@ def expected_pack_names(
|
||||
and to the name of the group it shares a pack with. ``variants`` lists
|
||||
the (source, required_only) combinations the run built.
|
||||
"""
|
||||
def narrow_tags(platform_name: str) -> list[str]:
|
||||
def narrowings(platform_name: str) -> list[list[tuple[str, str]]]:
|
||||
named = platform_target(platform_name, target_name, platforms_dir)
|
||||
return [
|
||||
"".join(
|
||||
tag
|
||||
for tag, _label in pack_narrowings(
|
||||
source, regions, named, False, required, no_game_data=no_game_data
|
||||
)
|
||||
)
|
||||
pack_narrowings(source, regions, named, False, required, no_game_data=no_game_data)
|
||||
for source, required in variants
|
||||
]
|
||||
|
||||
names: dict[str, set[str]] = {
|
||||
p: {
|
||||
f"{platform_pack_stem([p], p, platforms_dir)}{tags}_BIOS_Pack.zip"
|
||||
for tags in narrow_tags(p)
|
||||
platform_pack_name(p, platforms_dir, narrowed, None)
|
||||
for narrowed in narrowings(p)
|
||||
}
|
||||
for p in platforms
|
||||
}
|
||||
@@ -258,11 +256,11 @@ def expected_pack_names(
|
||||
):
|
||||
if len(group) < 2:
|
||||
continue
|
||||
stem = platform_pack_stem(group, representative, platforms_dir)
|
||||
for tags in narrow_tags(representative):
|
||||
for narrowed in narrowings(representative):
|
||||
name = platform_pack_name(representative, platforms_dir, narrowed, None, group=group)
|
||||
for p in group:
|
||||
if p in names:
|
||||
names[p].add(f"{stem}{tags}_BIOS_Pack.zip")
|
||||
names[p].add(name)
|
||||
return names
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user