mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-22 17:47:48 -06:00
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.
36 lines
1.3 KiB
Python
36 lines
1.3 KiB
Python
"""What fails a verify run under --strict, and the line that says why."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from packs.verdicts import Severity, Status
|
|
|
|
|
|
def platform_strict_failure(results: list[dict]) -> str | None:
|
|
"""The failure of platform results counting a critical file: a required
|
|
file missing where the frontend reads hashes, or None.
|
|
|
|
A file present whose hash the frontend does not confirm is UNTESTED, a
|
|
warning (Batocera's BiosStatus calls it so): reported, not failed.
|
|
"""
|
|
critical = sum(r["severity_counts"].get(Severity.CRITICAL, 0) for r in results)
|
|
if not critical:
|
|
return None
|
|
return (f"ERROR: {critical} required file(s) missing where the frontend "
|
|
"checks hashes")
|
|
|
|
|
|
def emulator_strict_failure(result: dict) -> str | None:
|
|
"""The failure of an emulator lacking a file it cannot run without, or None.
|
|
|
|
The emulator, not a frontend, is the judge here: a required file with no
|
|
HLE fallback that the collection does not hold stops the core.
|
|
"""
|
|
missing = sorted({
|
|
d["name"] for d in result["details"]
|
|
if d["status"] == Status.MISSING and d.get("required", True)
|
|
and not d.get("hle_fallback")
|
|
})
|
|
if not missing:
|
|
return None
|
|
return f"ERROR: {len(missing)} required file(s) missing: {', '.join(missing)}"
|