mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-04-13 12:22:33 -05:00
Critical: stream large file downloads (OOM fix), fix basename match in auto_fetch, include hashes in pack grouping fingerprint, handle not_in_zip status in verify, fix escaped quotes in batocera parser. Important: deduplicate shared group includes, catch coreinfo network errors, fix NODEDUP path component match, fix CI word splitting on spaces, replace bare except Exception in 3 files. Minor: argparse in list_platforms, specific exceptions in download.py.
82 lines
2.3 KiB
Python
82 lines
2.3 KiB
Python
#!/usr/bin/env python3
|
|
"""List available platforms for CI matrix strategy.
|
|
|
|
Respects the `status` field in _registry.yml:
|
|
- active: included in CI releases and automated scraping
|
|
- archived: excluded from CI, user can generate manually
|
|
|
|
Usage:
|
|
python scripts/list_platforms.py # Active platforms (for CI)
|
|
python scripts/list_platforms.py --all # All platforms including archived
|
|
python scripts/list_platforms.py >> "$GITHUB_OUTPUT"
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import json
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
try:
|
|
import yaml
|
|
except ImportError:
|
|
yaml = None
|
|
|
|
PLATFORMS_DIR = "platforms"
|
|
|
|
|
|
def _load_registry(platforms_dir: str = PLATFORMS_DIR) -> dict:
|
|
"""Load _registry.yml if available."""
|
|
registry_path = Path(platforms_dir) / "_registry.yml"
|
|
if yaml and registry_path.exists():
|
|
with open(registry_path) as f:
|
|
return yaml.safe_load(f) or {}
|
|
return {}
|
|
|
|
|
|
def list_platforms(include_archived: bool = False) -> list[str]:
|
|
"""List platform config files, filtering by status from _registry.yml."""
|
|
platforms_dir = Path(PLATFORMS_DIR)
|
|
if not platforms_dir.is_dir():
|
|
return []
|
|
|
|
registry = _load_registry(str(platforms_dir))
|
|
registry_platforms = registry.get("platforms", {})
|
|
|
|
platforms = []
|
|
for f in sorted(platforms_dir.glob("*.yml")):
|
|
if f.name.startswith("_"):
|
|
continue
|
|
name = f.stem
|
|
status = registry_platforms.get(name, {}).get("status", "active")
|
|
if status == "archived" and not include_archived:
|
|
continue
|
|
platforms.append(name)
|
|
|
|
return platforms
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description="List available platforms")
|
|
parser.add_argument("--all", action="store_true", help="Include archived platforms")
|
|
args = parser.parse_args()
|
|
|
|
platforms = list_platforms(include_archived=args.all)
|
|
|
|
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__":
|
|
main()
|