Files
libretro/scripts/list_platforms.py
T
Abdessamad Derraz 48d88da168 refactor: move six command run modes to packages
generate_db, generate_games_index, download, romset_recipes, validate_pr and list_platforms keep only main and build_parser: the database build goes to collection.run, the games index run to games.run, the pack info and its no-pack message to release.packinfo, the capture and build runs to romrecipes.runs, the file selection to resolve.reviewfiles. Tests reach the moved code through those packages.
2026-11-21 15:47:20 +01:00

46 lines
1.1 KiB
Python

#!/usr/bin/env python3
"""List the platforms registered in _registry.yml.
Usage:
python scripts/list_platforms.py
python scripts/list_platforms.py >> "$GITHUB_OUTPUT"
"""
from __future__ import annotations
import argparse
import json
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
from core.paths import PLATFORMS_DIR
from model.registry import list_registered_platforms
def main() -> None:
parser = argparse.ArgumentParser(allow_abbrev=False, description="List available platforms")
args = parser.parse_args()
from model.cliargs import work_from_repo_root
work_from_repo_root(args, parser, [])
platforms = list_registered_platforms(PLATFORMS_DIR)
if not platforms:
print("No platform configs found", file=sys.stderr)
sys.exit(1)
github_output = os.environ.get("GITHUB_OUTPUT")
if github_output:
with open(github_output, "a") as f:
f.write(f"platforms={json.dumps(platforms)}\n")
else:
print(json.dumps(platforms))
if __name__ == "__main__":
from core.cli import run_cli
run_cli(main)