make_game --pick: on macOS, the folder dialog is osascript's choose folder, so it needs no Tkinter (MAKE-GAME-PICK-MACOS) #2185

Open
github-bot wants to merge 3 commits from github-bot/gh-2185 into main AGit
Owner

@⁠Tauwni on GitHub · 2026-11-26 03:06 UTC · original
Tauwni:fix/make-game-pick-macos-osascript → main · +56 −11 · 2 files · 3 commits · draft

Claimed in the coordination issue as: MAKE-GAME-PICK-MACOS (#1608)

What and why

make_game.py --pick opens its folder dialog through Tk on macOS. Homebrew's Python ships without Tkinter (it's a separate [email protected] formula), so on a Mac with Homebrew's Python --pick stops:

The folder dialog couldn't open (No module named '_tkinter'). Give the folder with --game.

osascript is on every Mac, and its choose folder is the system folder dialog. native_picker() now returns it on macOS, the way kdialog and zenity are the native tools on Linux:

  • native_ask: choose folder with prompt … default location …. The prompt and the start folder are passed as argv, not pasted into the script, so a path with quotes needs no escaping. Cancel is AppleScript error -128, which osascript exits 1 with, the code native_ask already treats as cancelled.
  • native_warn: display dialog … with icon caution, also with the message passed as argv.
  • The flow is the same as on Linux: it asks again from the last folder after a warning. If osascript fails to run, it falls back to Tk as before.

Tested

Apple M3, macOS 26.5.1:

  • Both scripts compile with osacompile. The warning dialog showed a message with quotes, a backslash and a newline, passed as argv (run with giving up after 1). The choose folder dialog opened on the home folder. Cancel (error number -128) exits 1.
  • tests/test_make_game_pick.py: 17 tests OK on Python 3.12 and 3.15. New tests cover macOS picking osascript (and nothing when it's missing), the arguments of the ask and the warning, and cancel. The old "None on macOS" case now only covers Windows. All tests/test_make_game*.py are OK.

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption.

🤖 Generated with Claude Code

**@⁠Tauwni** on GitHub · 2026-11-26 03:06 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2185) `Tauwni:fix/make-game-pick-macos-osascript` → `main` · +56 −11 · 2 files · 3 commits · draft Claimed in the coordination issue as: MAKE-GAME-PICK-MACOS (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why `make_game.py --pick` opens its folder dialog through Tk on macOS. Homebrew's Python ships without Tkinter (it's a separate `[email protected]` formula), so on a Mac with Homebrew's Python `--pick` stops: ``` The folder dialog couldn't open (No module named '_tkinter'). Give the folder with --game. ``` `osascript` is on every Mac, and its `choose folder` is the system folder dialog. `native_picker()` now returns it on macOS, the way kdialog and zenity are the native tools on Linux: - `native_ask`: `choose folder with prompt … default location …`. The prompt and the start folder are passed as `argv`, not pasted into the script, so a path with quotes needs no escaping. Cancel is AppleScript error -128, which `osascript` exits 1 with, the code `native_ask` already treats as cancelled. - `native_warn`: `display dialog … with icon caution`, also with the message passed as `argv`. - The flow is the same as on Linux: it asks again from the last folder after a warning. If `osascript` fails to run, it falls back to Tk as before. ### Tested Apple M3, macOS 26.5.1: - Both scripts compile with `osacompile`. The warning dialog showed a message with quotes, a backslash and a newline, passed as `argv` (run with `giving up after 1`). The `choose folder` dialog opened on the home folder. Cancel (`error number -128`) exits 1. - `tests/test_make_game_pick.py`: 17 tests OK on Python 3.12 and 3.15. New tests cover macOS picking osascript (and nothing when it's missing), the arguments of the ask and the warning, and cancel. The old "None on macOS" case now only covers Windows. All `tests/test_make_game*.py` are OK. AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Homebrew's Python ships without Tkinter, so --pick on a Mac stopped with "The folder dialog couldn't open (No module
named '_tkinter')". osascript is on every Mac; it is the native tool there, as kdialog and zenity are on Linux, with
Tk still the fallback. Prompt and folder go in as arguments, so nothing is quoted into the script.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:21:37 +00:00
Author
Owner

@⁠real-rusher on GitHub · 2026-11-26 10:12 UTC · original

Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU; no macOS here, so the osascript path itself is only covered by the mocked tests). Merges cleanly. With this PR, python -I tests/test_make_game_pick.py: 17 tests OK. The PR's test file against main's make_game.py: 2 failures, so the new tests fail on main and pass with the change. compileall clean.

AI-assisted: yes (Claude Code)

**@⁠real-rusher** on GitHub · 2026-11-26 10:12 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2185#issuecomment-7189056460) Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU; no macOS here, so the osascript path itself is only covered by the mocked tests). Merges cleanly. With this PR, python -I tests/test_make_game_pick.py: 17 tests OK. The PR's test file against main's make_game.py: 2 failures, so the new tests fail on main and pass with the change. compileall clean. AI-assisted: yes (Claude Code)
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/2185/head:github-bot/gh-2185'
git switch 'github-bot/gh-2185'

Merge

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