Fail closed when Rayforge runtime is missing

This commit is contained in:
Codex 2026-10-19 19:55:02 +02:00
parent 583540a90c
commit 5945bb0b61
2 changed files with 28 additions and 15 deletions

View file

@ -11,6 +11,7 @@ from pathlib import Path
def inspect(rayforge: Path, python_env: Path) -> dict[str, object]:
msys2_shell = Path("C:/msys64/msys2_shell.cmd")
msys2_env = rayforge / ".msys2_env"
if python_env.is_file():
gi_probe = subprocess.run(
[str(python_env), "-c", "import gi"],
capture_output=True,
@ -26,6 +27,9 @@ def inspect(rayforge: Path, python_env: Path) -> dict[str, object]:
),
"unable to import gi",
)
else:
gi_available = False
gi_error = "python runtime not found"
app_entry = rayforge / "rayforge" / "__main__.py"
addon_manifest = (
Path(__file__).parents[1]

View file

@ -1,6 +1,9 @@
import json
import unittest
from pathlib import Path
import tempfile
from scripts.check_rayforge_windows_gui import inspect
ROOT = Path(__file__).parents[1]
@ -30,6 +33,12 @@ class RayforgeWindowsGuiPreflightTests(unittest.TestCase):
def test_result_records_the_requested_runtime_probe(self):
self.assertIn("No module named 'gi'", self.result["observed_launch_error"])
def test_missing_runtime_path_fails_closed(self):
with tempfile.TemporaryDirectory() as temporary:
result = inspect(Path(temporary), Path(temporary) / "missing-python.exe")
self.assertFalse(result["ready_for_manual_gui_test"])
self.assertEqual("python runtime not found", result["observed_launch_error"])
if __name__ == "__main__":
unittest.main()