Jelajahi Sumber

fix(replay): use LD-safe python for detached unit subprocesses

Co-authored-by: Cursor <cursoragent@cursor.com>
root 3 bulan lalu
induk
melakukan
c7c726d8db
1 mengubah file dengan 17 tambahan dan 2 penghapusan
  1. 17 2
      tools/replay_review_compact.py

+ 17 - 2
tools/replay_review_compact.py

@@ -40,6 +40,21 @@ REFERENCE_REGENERATION_REPLAY = "not_packaged_by_policy"
 HARDWARE_VALIDATION = "not_run"
 
 
+def _safe_python() -> str:
+    """Avoid bare oss-cad libexec (needs ld-linux + libpython)."""
+    override = os.environ.get("PRODU2_VERIFY_PYTHON", "").strip()
+    if override:
+        return override
+    wrapper = Path("/data/prod2u/venvs/verify/bin/python")
+    exe = Path(sys.executable)
+    if "libexec" in exe.as_posix() and wrapper.is_file():
+        return str(wrapper)
+    if wrapper.is_file():
+        return str(wrapper)
+    return str(exe)
+
+
+
 class ReplayError(RuntimeError):
     """Replay orchestration failure."""
 
@@ -105,7 +120,7 @@ def _run_unittest_modules(software_root: Path, modules: list[str]) -> dict[str,
             )
             continue
         completed = subprocess.run(
-            [sys.executable, "-B", "-m", "unittest", module, "-q"],
+            [_safe_python(), "-B", "-m", "unittest", module, "-q"],
             cwd=str(software_root),
             env=env,
             stdout=subprocess.PIPE,
@@ -198,7 +213,7 @@ def _board_detached_check(cpld_root: Path) -> dict[str, Any]:
 
     completed = subprocess.run(
         [
-            sys.executable,
+            _safe_python(),
             "-B",
             str(validator),
             "--generated",