feat: list platforms with --list-platforms

install.py took --list-platforms, generate_pack.py --list and verify.py
nothing. Both tools now take --list-platforms and print the same list
from common.py. generate_pack.py keeps --list (finding 80).
This commit is contained in:
Abdessamad Derraz committed 2026-11-05 11:52:26 +01:00
1 parent 000877689f
commit f2e25aeea2
5 files changed
+63 -21

No files matched your search

+16
View File
@@ -3192,6 +3192,22 @@ def list_system_ids(emulators_dir: str) -> None:
print(f" {spelling:35s} ({count} emulator{'s' if count > 1 else ''})")
def print_platform_listing(platforms_dir: str) -> None:
"""Every registered platform, one per line, marked when archived or
served by the installer only.
Every platform takes --platform. --all covers the active ones, and the
pack builder's --all the release packs. Printed by --list-platforms in
verify.py and generate_pack.py, the name install.py gives it.
"""
active = set(list_registered_platforms(platforms_dir))
released = set(list_release_pack_platforms(platforms_dir, include_archived=True))
for name in list_registered_platforms(platforms_dir, include_archived=True):
marks = [m for m, on in (("archived", name not in active),
("installer only", name not in released)) if on]
print(f"{name} ({', '.join(marks)})" if marks else name)
def list_platform_system_ids(platform_name: str, platforms_dir: str) -> None:
"""Print system IDs from a platform's YAML config, with the platform's
own names for them, which --system also accepts."""
+10 -17
View File
@@ -53,6 +53,7 @@ from common import (
list_platform_system_ids,
platform_system_names,
resolve_system_arg,
print_platform_listing,
select_systems,
platform_scope_systems,
system_scope_error,
@@ -1866,11 +1867,6 @@ def generate_system_pack(
shutil.rmtree(scratch, ignore_errors=True)
def list_platforms(platforms_dir: str) -> list[str]:
"""List available platform names from registry."""
return list_registered_platforms(platforms_dir, include_archived=True)
def _system_display_name(system_id: str) -> str:
"""Convert system ID to display name for ZIP naming."""
s = system_id.lower().replace("_", "-")
@@ -3097,7 +3093,7 @@ def _refuse_unapplied_flags(args: argparse.Namespace, parser: argparse.ArgumentP
name for name, on in (
("--manifest-targets", args.manifest_targets),
("--verify-packs", args.verify_packs and not args.all_variants),
("--list", args.list),
("--list-platforms", args.list),
("--list-emulators", args.list_emulators),
("--list-systems", args.list_systems),
("--list-targets", args.list_targets),
@@ -3123,7 +3119,7 @@ QUICK_MODE_FLAGS: dict[str, set[str]] = {
},
# One manifest per hardware target, from the target files themselves.
"--manifest-targets": set(),
"--list": set(),
"--list-platforms": set(),
"--list-emulators": set(),
"--list-systems": {"--platform"},
"--list-targets": {"--platform"},
@@ -3152,7 +3148,7 @@ def _given_flags(args: argparse.Namespace) -> set[str]:
"--target": args.target,
"--region": args.region,
"--one-per-slot": args.one_per_slot,
"--list": args.list,
"--list-platforms": args.list,
"--list-emulators": args.list_emulators,
"--list-systems": args.list_systems,
"--list-targets": args.list_targets,
@@ -3249,7 +3245,11 @@ def _main(held: contextlib.ExitStack) -> None:
action="store_true",
help="Pack the data directories as cached, still fetching release assets",
)
parser.add_argument("--list", action="store_true", help="List available platforms")
# install.py's name. --list stays for the scripts that already type it.
parser.add_argument(
"--list-platforms", "--list", dest="list", action="store_true",
help="List available platforms",
)
parser.add_argument(
"--required-only",
action="store_true",
@@ -3351,14 +3351,7 @@ def _main(held: contextlib.ExitStack) -> None:
)
return
if args.list:
# Every platform builds with --platform. --all builds the release
# packs only, the others are served by the installer.
active = set(list_registered_platforms(args.platforms_dir))
released = set(list_release_pack_platforms(args.platforms_dir, include_archived=True))
for p in list_platforms(args.platforms_dir):
marks = [m for m, on in (("archived", p not in active),
("installer only", p not in released)) if on]
print(f"{p} ({', '.join(marks)})" if marks else p)
print_platform_listing(args.platforms_dir)
return
if args.list_emulators:
list_emulator_profiles(args.emulators_dir)
+10 -3
View File
@@ -63,6 +63,7 @@ from common import (
load_emulator_profiles,
load_platform_config,
resolve_system_arg,
print_platform_listing,
select_systems,
platform_scope_systems,
system_scope_error,
@@ -2620,6 +2621,7 @@ def _refuse_listing_narrowings(
"""
listing = next(
(flag for flag, on in (
("--list-platforms", args.list_platforms),
("--list-emulators", args.list_emulators),
("--list-systems", args.list_systems),
("--list-targets", args.list_targets),
@@ -2628,7 +2630,7 @@ def _refuse_listing_narrowings(
)
if not listing:
return
reads_platform = listing != "--list-emulators"
reads_platform = listing not in ("--list-emulators", "--list-platforms")
for flag, on in (
("--platform", args.platform and not reads_platform),
("--all", args.all),
@@ -2678,7 +2680,9 @@ def _refuse_mode_flags(args: argparse.Namespace, parser: argparse.ArgumentParser
def _run_listing(args: argparse.Namespace, parser: argparse.ArgumentParser) -> None:
if args.list_emulators:
if args.list_platforms:
print_platform_listing(args.platforms_dir)
elif args.list_emulators:
list_emulator_profiles(args.emulators_dir)
elif args.list_systems and args.platform:
list_platform_system_ids(args.platform, args.platforms_dir)
@@ -2717,6 +2721,9 @@ def _main(held: contextlib.ExitStack) -> None:
parser.add_argument(
"--list-systems", action="store_true", help="List available systems"
)
parser.add_argument(
"--list-platforms", action="store_true", help="List available platforms"
)
parser.add_argument(
"--include-archived", action="store_true",
help="With --all, also verify the archived platforms (RetroPie)",
@@ -2790,7 +2797,7 @@ def _main(held: contextlib.ExitStack) -> None:
parser.error(str(exc))
_refuse_listing_narrowings(args, parser)
if args.list_emulators or args.list_systems or args.list_targets:
if args.list_platforms or args.list_emulators or args.list_systems or args.list_targets:
_run_listing(args, parser)
return