Build.bat/Mods.bat: quote per-user Python paths, sync lookup, and add no-pause guard #2342

Open
github-bot wants to merge 1 commit from github-bot/gh-2342 into main AGit
Owner

@⁠kirigayakazima on GitHub · 2026-11-26 14:12 UTC · original
kirigayakazima:fix/win-launchers-bat-safety → main · +176 −25 · 3 files · 1 commits · open

Claimed in the coordination issue as: WIN-LAUNCHERS-BUILD-MODS-BAT-QUOTING-USER-PYTHON-AND-NO-PAUSE (#1608)

What and why

  • Quote per-user Python resolution safely in Build.bat and Mods.bat by splitting PY into quoted PY_EXE and PY_ARG (set "PY_EXE=%~1", invoking "%PY_EXE%" %PY_ARG% -I ...) and quoting "%~1" in :try_python so per-user install paths containing spaces or & work without unquoted syntax errors.
  • Add :find_user_python and :try_python to Mods.bat (matching Build.bat) so per-user Python installs under %LOCALAPPDATA%\Programs\Python\Python3* work in the mod manager launcher as well.
  • Guard interactive pause calls in both Build.bat and Mods.bat with if not defined LEONIDA_NO_PAUSE pause, and add PYTMP fallbacks (%TEMP% -> %LOCALAPPDATA%\Temp -> %~dp0) in Build.bat's :py_download.
  • Add standard-library tests in tests/test_win_launchers.py.

Tested

  • python -I tests/test_win_launchers.py -v: 2 passed, 0 failed (detached upstream/main baseline with only the new test file fails with 2 failures).
  • python -I tests/test_ci_registration.py: 16 passed.
  • python -I tests/test_text_write_line_endings.py: 3 passed.
  • python -I scripts/check_no_game_data.py, python -I -m compileall -q tests/test_win_launchers.py, and git diff --cached --check: passed.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.
**@⁠kirigayakazima** on GitHub · 2026-11-26 14:12 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2342) `kirigayakazima:fix/win-launchers-bat-safety` → `main` · +176 −25 · 3 files · 1 commits · open Claimed in the coordination issue as: WIN-LAUNCHERS-BUILD-MODS-BAT-QUOTING-USER-PYTHON-AND-NO-PAUSE (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why - Quote per-user Python resolution safely in `Build.bat` and `Mods.bat` by splitting `PY` into quoted `PY_EXE` and `PY_ARG` (`set "PY_EXE=%~1"`, invoking `"%PY_EXE%" %PY_ARG% -I ...`) and quoting `"%~1"` in `:try_python` so per-user install paths containing spaces or `&` work without unquoted syntax errors. - Add `:find_user_python` and `:try_python` to `Mods.bat` (matching `Build.bat`) so per-user Python installs under `%LOCALAPPDATA%\Programs\Python\Python3*` work in the mod manager launcher as well. - Guard interactive `pause` calls in both `Build.bat` and `Mods.bat` with `if not defined LEONIDA_NO_PAUSE pause`, and add `PYTMP` fallbacks (`%TEMP%` -> `%LOCALAPPDATA%\Temp` -> `%~dp0`) in `Build.bat`'s `:py_download`. - Add standard-library tests in `tests/test_win_launchers.py`. ### Tested - `python -I tests/test_win_launchers.py -v`: 2 passed, 0 failed (detached `upstream/main` baseline with only the new test file fails with 2 failures). - `python -I tests/test_ci_registration.py`: 16 passed. - `python -I tests/test_text_write_line_endings.py`: 3 passed. - `python -I scripts/check_no_game_data.py`, `python -I -m compileall -q tests/test_win_launchers.py`, and `git diff --cached --check`: passed. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 14:13:45 +00:00
Author
Owner

@⁠lixonik on GitHub · 2026-11-26 15:40 UTC · original · reviewed

Windows 11: both launcher tests passed, including native cmd.exe and PowerShell tests with a disposable per-user Python path containing spaces and an ampersand, LEONIDA_NO_PAUSE, and exact exit-code propagation. No findings.

AI-assisted.

**@⁠lixonik** on GitHub · 2026-11-26 15:40 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2342#pullrequestreview-6076919383) · **reviewed** Windows 11: both launcher tests passed, including native cmd.exe and PowerShell tests with a disposable per-user Python path containing spaces and an ampersand, `LEONIDA_NO_PAUSE`, and exact exit-code propagation. No findings. AI-assisted.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2342/head:github-bot/gh-2342'
git switch 'github-bot/gh-2342'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2342'
git switch 'github-bot/gh-2342'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2342'
git switch 'github-bot/gh-2342'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2342'
git switch 'main'
git merge --squash 'github-bot/gh-2342'
git switch 'main'
git merge --ff-only 'github-bot/gh-2342'
git switch 'main'
git merge 'github-bot/gh-2342'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.