mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-23 10:07:48 -06:00
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.
40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
"""What download.py prints about one platform's pack, or about its absence from a release."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from typing import NoReturn
|
|
|
|
from core.sizes import size_text
|
|
from core.text import count_text
|
|
from release.packgroups import find_pack, list_platforms
|
|
|
|
# A release publishes packs for the setups most people download. The others
|
|
# are served file by file by the installer.
|
|
NO_PACK_HINT = (
|
|
"A setup without a pack is served by the installer:\n"
|
|
" curl -fsSL https://abdess.github.io/retrobios/i | sh -s -- --platform <name>"
|
|
)
|
|
|
|
|
|
def exit_without_pack(platform: str, release: dict) -> NoReturn:
|
|
"""Name the packs the release holds and point to the installer, exit 1."""
|
|
print(f"Platform '{platform}' not found in release.")
|
|
print("Available:", ", ".join(list_platforms(release)))
|
|
print(NO_PACK_HINT)
|
|
sys.exit(1)
|
|
|
|
|
|
def show_info(platform: str, release: dict) -> None:
|
|
"""Show pack information for a platform."""
|
|
pack = find_pack(release, platform)
|
|
if not pack:
|
|
exit_without_pack(platform, release)
|
|
|
|
print(f" Platform: {pack.platform}")
|
|
print(f" File: {pack.name}")
|
|
print(f" Parts: {count_text(len(pack.parts), 'part')}")
|
|
print(f" Size: {pack.size:,} bytes ({size_text(pack.size)})")
|
|
for part in pack.parts:
|
|
print(f" {part['name']} ({part.get('size', 0):,} bytes)")
|