fix(windows): bundle Tcl/Tk data in PyInstaller builds - #1976
Conversation
Pin the Windows build toolchain and verify bundled Tcl/Tk data to prevent the configurator from failing at startup.
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pins the Windows packaging toolchain and ensures PyInstaller bundles Tcl/Tk library data so the Windows configurator doesn’t fail at startup due to missing tkinter runtime data.
Changes:
- Set
TCL_LIBRARY/TK_LIBRARYin the PyInstaller spec to force bundling of Tcl/Tk data. - Pin/update packaging dependencies (including
pyinstaller-hooks-contrib) and lockuvto an exact version. - Make the CI Windows build more reproducible (exact Python version) and add verification that Tcl/Tk data was bundled.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| windows/ardupilot_methodic_configurator.spec | Forces discovery of Tcl/Tk library directories at build time so PyInstaller collects the right data. |
| pyproject.toml | Pins/extends build tool dependencies (hooks contrib) and locks uv version for reproducibility. |
| .github/workflows/build_windows_macos.yml | Pins Windows Python patch version and adds CI checks to validate Tcl/Tk bundling and runtime introspection. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| import sys | ||
|
|
||
|
|
||
| def _find_tcl_tk_library(directory: Path, prefix: str) -> Path: | ||
| """Return the Tcl/Tk library directory shipped with the build Python.""" | ||
| library_file = "init.tcl" if prefix == "tcl" else "tk.tcl" | ||
| candidates = sorted( | ||
| (path for path in directory.glob(f"{prefix}*") if path.is_dir() and (path / library_file).is_file()), | ||
| reverse=True, | ||
| ) | ||
| if not candidates: | ||
| raise SystemExit(f"Could not find {prefix} library data below {directory}") | ||
| return candidates[0] |
| if (-not (Test-Path "dist\\ardupilot_methodic_configurator\\_internal\\_tcl_data\\init.tcl") -or | ||
| -not (Test-Path "dist\\ardupilot_methodic_configurator\\_internal\\_tk_data\\tk.tcl")) { | ||
| throw "PyInstaller did not bundle the Tcl/Tk library data." |
☂️ Code Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
Coverage Report for CI Build 32777142343Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage remained the same at 88.958%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
Description
Pin the Windows build toolchain and verify bundled Tcl/Tk data to prevent the configurator from failing at startup.
Checklist
git commit --signoff)Testing
Describe how you tested these changes: