Files
mtgodot-poc/.agents/skills/metin2-40250-parity-audit/scripts/refroot.py
T
shenleiandClaude Opus 5 55f733fda6 audit: phase 0 tooling for file-by-file 40250 porting
- refroot.py: one reference-root resolver (MT_40250_SOURCE, then manifest)
  used by every audit script; missing tree or fingerprint input is an error
- port_map.py: per-function inventory of active 40250 units plus the
  40250 Python root, status/queue/init/show/check, 40250: tag scan
- manifest: fix 18 wrong reference paths (Python UI now points at the
  40250 Client/Eternexus/root, not the m2dev assets/root), drop 2 deleted
  implementation files, move 64 prose test entries to evidence.commands
- first port-map entry: PythonPlayerEventHandler.cpp
- roadmap replaced by a batch/unit queue

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 17:17:49 +09:00

31 lines
1.0 KiB
Python

"""Locate the 40250 reference source tree for the audit scripts.
Order: `MT_40250_SOURCE` env var, then `reference_root` in `audit/manifest.json`
(relative to the repository root). A missing tree is an error, never a silent fallback.
"""
from __future__ import annotations
import json
import os
from pathlib import Path
def repo_root() -> Path:
return Path(__file__).resolve().parents[4]
def reference_root(repo: Path | None = None) -> Path:
repo = (repo or repo_root()).resolve()
raw = os.environ.get("MT_40250_SOURCE")
if not raw:
manifest = json.loads((repo / "audit" / "manifest.json").read_text(encoding="utf-8"))
raw = manifest.get("reference_root", "")
if not raw:
raise SystemExit("40250 reference root not set: export MT_40250_SOURCE or set manifest reference_root")
path = Path(raw)
path = (path if path.is_absolute() else repo / path).resolve()
if not (path / "UserInterface").is_dir():
raise SystemExit(f"40250 reference root not found or incomplete: {path}")
return path