Files
libretro/scripts/packs/crossreflaunchers.py
T
Abdessamad Derraz 6ba52a9682 refactor: move verify, slots, crossref into packs
The three commands keep their parser, main and printing. Scans, scopes,
report text, the JSON forms, the strict gate and the destinations file
live in new packs modules, one subject each.
2026-11-21 14:58:26 +01:00

50 lines
1.7 KiB
Python

"""The launcher rows of a gap report: names read and not held, records left unproven."""
from __future__ import annotations
from model.platforms import load_platform_config
from model.registry import list_registered_platforms
from packs.crossref import launcher_reads_not_held
from resolve.launchers import LauncherLayer, launcher_unproven
# The --json key of the launcher reads category, beside the emulator keys.
LAUNCHER_READS_KEY = "_launcher_reads_not_held"
# The --json key of the launcher records a config file does not prove.
LAUNCHER_UNPROVEN_KEY = "_launcher_unproven"
def launcher_rows(
selected: list[str] | None,
platforms_dir: str,
db: dict,
all_profiles: dict[str, dict],
registry: dict,
emulator: str | None,
) -> tuple[list[dict], list[dict]]:
"""The names a launcher reads that the collection lacks, and the
launcher records nothing proves."""
# Counted apart from the profile gaps: a name only a launcher reads is
# reported, not yet judged.
launcher_reads = launcher_reads_not_held(
{
name: load_platform_config(name, platforms_dir)
for name in (selected or list_registered_platforms(platforms_dir))
},
db, all_profiles, registry, emulator or "",
)
unproven = [
row for row in launcher_unproven(
{
name: load_platform_config(name, platforms_dir)
for name in (selected or list_registered_platforms(platforms_dir))
},
all_profiles,
)
if not emulator or any(
emulator in LauncherLayer._profiles_named(part, all_profiles, set(all_profiles))
for part in row["emulator"].split(", ")
)
]
return launcher_reads, unproven