fix: record every profile a pass writes

This commit is contained in:
Abdessamad Derraz committed 2026-11-21 16:43:46 +01:00
1 parent 2025a71cb9
commit 714683d63c
5 files changed
+91 -40

No files matched your search

+8 -10
View File
@@ -8,32 +8,30 @@ from pathlib import Path
from core import upstream
from profiling.realign import realign_prose
from profiling.run import WRITTEN_PROFILES
from profiling.sourcepaths import refresh_source_paths
from profiling.sourcepaths import record_write, refresh_source_paths
from profiling.yamledit import YamlWriteError
def run_realign(args: argparse.Namespace, selected: dict) -> None:
"""--realign-prose over the selected profiles, exit 1 when one failed."""
failed: set[str] = set()
written: set[str] = set()
for name in selected:
profile_path = Path(args.emulators_dir) / f"{name}.yml"
if not profile_path.is_file():
continue
try:
before = profile_path.read_bytes()
for line in realign_prose(
profile_path, args.cache_dir, args.offline, args.dry_run
):
print(f"{name}: {line}")
if profile_path.read_bytes() != before:
WRITTEN_PROFILES.add(name)
with record_write(profile_path, name, written):
for line in realign_prose(
profile_path, args.cache_dir, args.offline, args.dry_run
):
print(f"{name}: {line}")
except upstream.UpstreamError as exc:
print(f"{name}: {exc}", file=sys.stderr)
failed.add(name)
except YamlWriteError as exc:
print(f"{name}: write refused: {exc}", file=sys.stderr)
failed.add(name)
refresh_source_paths(args)
refresh_source_paths(args, written)
if failed:
raise SystemExit(1)