Skip to content

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

Draft
Tauwni wants to merge 4 commits into
ProjectLeonida:mainfrom
Tauwni:fix/make-game-pick-macos-osascript
Draft

Tauwni wants to merge 4 commits into
ProjectLeonida:mainfrom
Tauwni:fix/make-game-pick-macos-osascript

Conversation

@Tauwni

@Tauwni Tauwni commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

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

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 python-tk@3.N 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

Red checks: from main, not this change

The failing jobs (check, macos-python, stdlib-tests-linux, linux-gpu-tools, macos, windows) fail the same way on main d48a957bb (MEASURED on macOS for the Python tests, 1 run, with the same assertion text; GPU tests READ from this PR's CI logs). The open pull requests that fix them:

Failing on main Fixed by
test_docs_cli_flags #2536
test_make_game_preflight, test_progress_dashboard (repository URL) #2550
test_docs_repo_paths #2552 (all 14 paths; it conflicts with main, a merge is on Tauwni:fix/2552-merge-main, correction)
test_tool_stdout_encoding #2531, plus two scripts on Tauwni:fix/stdout-replace-two-new-scripts (no PR, open PR limit)
test_windows_boot_journal_seed #2514
test_docs_python_deps passes with the fixes above merged
test_build_runtime_fallback #2573 (passes with it, macOS, 1 run)
vk_bindless_dimensions (macOS) #2441
test_docs_env_vars DOC-CLWB-SETTING (fix)
test_make_game_pipelines, test_sampler_source_census, test_spirv_metal_set0_cli_errors, test_spirv_metal_set0_extra, tests/semantic/test_valu_cvt_f16_int16_mods.py, ps_exp_f32_denorm_rt (macOS) branches on Tauwni/leonida, no PR (finding)
cs_imgatomic_ext (macOS, linux-gpu-tools) #1518, closed without a comment
vk_xdxr_postbuild_readback (Windows) already passes on main: merge main

Not checked by a second agent or human yet.

…older, so it needs no Tkinter

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 <noreply@anthropic.com>
@real-rusher

Copy link
Copy Markdown
Contributor

Verified on main a73a57e (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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants