Builder: surface check failures and use a real Python #434

Merged
nicholasgower merged 2 commits from nup-fix into main 2026-11-08 19:22:24 +00:00
nicholasgower commented 2026-11-08 01:26:42 +00:00 (Migrated from github.com)

Two source-tree Builder fixes found while testing with a .nup.

1. A check that stops now says why. --check tests the compiler before it opens the package. A missing compiler raised SystemExit from toolchain.need(), which make_game.py re-raised without an @@error line; the WPF builder then showed "The game files could not be read." and the Linux builder "The version could not be read.", with the reason only on stderr (which Runner.Check discarded). check_windows_sdk() / check_mingw() now report a missing compiler through fail(), a text SystemExit becomes @@error, and both builders show the last stderr line when a step stops without a protocol line.

2. A real Python is found. Tools.Find() used python from PATH for source-tree runs. On Windows that is often the Store alias, which only opens the Store (exit 9009). It now prefers a real python.exe, then py -3, and passes the launcher's arguments before -I (py -I -3 made Python stop with "Unknown option: -3").

Tests (game-free):

python -I -B tests/test_check_no_compiler.py
python -I -B tests/test_builder_python.py
python -I -B tests/test_make_game_cache.py

all pass; dotnet build builder/HookshotBuilder/HookshotBuilder.csproj gives 0 warnings and 0 errors. With HOOKSHOT_MINGW set, make_game.py --check on a real .nup passes the compiler check and reads the package (@@check ok ... build e0f3ccfa). Both tests are wired into source-regressions.yml (run steps and path filters).

Assisted-by: DeepSeek V4.1 Flash (OpenCode)

Two source-tree Builder fixes found while testing with a `.nup`. **1. A check that stops now says why.** `--check` tests the compiler before it opens the package. A missing compiler raised `SystemExit` from `toolchain.need()`, which `make_game.py` re-raised without an `@@error` line; the WPF builder then showed "The game files could not be read." and the Linux builder "The version could not be read.", with the reason only on stderr (which `Runner.Check` discarded). `check_windows_sdk()` / `check_mingw()` now report a missing compiler through `fail()`, a text `SystemExit` becomes `@@error`, and both builders show the last stderr line when a step stops without a protocol line. **2. A real Python is found.** `Tools.Find()` used `python` from `PATH` for source-tree runs. On Windows that is often the Store alias, which only opens the Store (exit 9009). It now prefers a real `python.exe`, then `py -3`, and passes the launcher's arguments before `-I` (`py -I -3` made Python stop with "Unknown option: -3"). Tests (game-free): ```powershell python -I -B tests/test_check_no_compiler.py python -I -B tests/test_builder_python.py python -I -B tests/test_make_game_cache.py ``` all pass; `dotnet build builder/HookshotBuilder/HookshotBuilder.csproj` gives 0 warnings and 0 errors. With `HOOKSHOT_MINGW` set, `make_game.py --check` on a real `.nup` passes the compiler check and reads the package (`@@check ok ... build e0f3ccfa`). Both tests are wired into `source-regressions.yml` (run steps and path filters). Assisted-by: DeepSeek V4.1 Flash (OpenCode)
Commenting is not possible because the repository is archived.
No description provided.