mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-26 03:18:52 -06:00
refactor: move ten command helpers into packages
This commit is contained in:
1 parent
6d21a98342
commit
19681a3735
22 files changed
+218
-191
No files matched your search
@@ -17,47 +17,11 @@ then every count line.
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from core.artifacts import write_text_atomic
|
||||
from core.paths import REPO_ROOT
|
||||
|
||||
PAGE = REPO_ROOT / "wiki" / "reading-reports.md"
|
||||
BLOCK = re.compile(
|
||||
r"(<!-- generated: verify-retrodeck -->\n```\n)(.*?)(```\n<!-- /generated: verify-retrodeck -->)",
|
||||
re.S)
|
||||
# The count lines, in the order verify prints them.
|
||||
COUNTS = (" Core files:", " Bundled with their emulator", " Core files held",
|
||||
" Game data:", " Game data held", " Launcher reads", " Launcher records",
|
||||
" No external files:", " Ground truth:", " ")
|
||||
|
||||
|
||||
def excerpt(lines: list[str]) -> list[str]:
|
||||
"""The lines of a verify run the page shows."""
|
||||
kept = [lines[0]]
|
||||
untested = next((line for line in lines if line.startswith(" UNTESTED")), None)
|
||||
if untested:
|
||||
kept.append(untested)
|
||||
for index, line in enumerate(lines):
|
||||
if line.startswith(" DISCREPANCY") and index + 1 < len(lines) \
|
||||
and lines[index + 1].startswith(" "):
|
||||
kept += [line, lines[index + 1]]
|
||||
break
|
||||
counts_from = next(i for i, line in enumerate(lines) if line.startswith(" Core files:"))
|
||||
kept += [line for line in lines[counts_from:] if line.startswith(COUNTS)]
|
||||
return kept
|
||||
|
||||
|
||||
def run() -> list[str]:
|
||||
proc = subprocess.run([sys.executable, str(REPO_ROOT / "scripts" / "verify.py"),
|
||||
"--platform", "retrodeck"], capture_output=True, text=True,
|
||||
cwd=REPO_ROOT, check=False)
|
||||
lines = proc.stdout.splitlines()
|
||||
if not lines or not lines[0].startswith("RetroDECK:"):
|
||||
raise SystemExit(f"verify did not run: {proc.stderr[-300:]}")
|
||||
return lines
|
||||
from sitegen.reportexcerpt import BLOCK, PAGE, excerpt, run
|
||||
|
||||
|
||||
def main() -> int:
|
||||
|
||||
Reference in new issue
Block a user