From 583540a90c3bf4303e1eaf4dfa65aa401258bd5f Mon Sep 17 00:00:00 2001 From: Codex Date: Mon, 19 Oct 2026 19:54:11 +0200 Subject: [PATCH] Probe the requested Rayforge GUI runtime --- scripts/check_rayforge_windows_gui.py | 24 +++++++++++++++++--- tests/test_rayforge_windows_gui_preflight.py | 3 +++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/scripts/check_rayforge_windows_gui.py b/scripts/check_rayforge_windows_gui.py index bb86daa..c76cacc 100644 --- a/scripts/check_rayforge_windows_gui.py +++ b/scripts/check_rayforge_windows_gui.py @@ -3,15 +3,29 @@ from __future__ import annotations import argparse -import importlib.util import json +import subprocess 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" - gi_available = importlib.util.find_spec("gi") is not None + gi_probe = subprocess.run( + [str(python_env), "-c", "import gi"], + capture_output=True, + text=True, + check=False, + ) + gi_available = gi_probe.returncode == 0 + gi_error = next( + ( + line.strip() + for line in reversed(gi_probe.stderr.splitlines()) + if line.strip() + ), + "unable to import gi", + ) app_entry = rayforge / "rayforge" / "__main__.py" addon_manifest = ( Path(__file__).parents[1] @@ -36,7 +50,11 @@ def inspect(rayforge: Path, python_env: Path) -> dict[str, object]: "ready_for_manual_gui_test": ready, "status": "ready" if ready else "blocked", "missing_requirements": [key for key, passed in checks.items() if not passed], - "observed_launch_error": None if gi_available else "ModuleNotFoundError: No module named 'gi'", + "observed_launch_error": ( + None + if gi_available + else gi_error + ), "installation_performed": False, "next_action": ( "launch isolated no-device GUI test" diff --git a/tests/test_rayforge_windows_gui_preflight.py b/tests/test_rayforge_windows_gui_preflight.py index 59d7c00..fe9f2ef 100644 --- a/tests/test_rayforge_windows_gui_preflight.py +++ b/tests/test_rayforge_windows_gui_preflight.py @@ -27,6 +27,9 @@ class RayforgeWindowsGuiPreflightTests(unittest.TestCase): self.assertTrue(checks["application_entry_present"]) self.assertTrue(checks["no_device_addon_present"]) + def test_result_records_the_requested_runtime_probe(self): + self.assertIn("No module named 'gi'", self.result["observed_launch_error"]) + if __name__ == "__main__": unittest.main()