feat: bundle tkinter into Windows portable build
Some checks failed
Build Release / create-release (push) Successful in 5s
Lint & Test / test (push) Failing after 21s
Build Release / build-linux (push) Successful in 1m7s
Build Release / build-docker (push) Failing after 4s
Build Release / build-windows (push) Successful in 1m50s
Some checks failed
Build Release / create-release (push) Successful in 5s
Lint & Test / test (push) Failing after 21s
Build Release / build-linux (push) Successful in 1m7s
Build Release / build-docker (push) Failing after 4s
Build Release / build-windows (push) Successful in 1m50s
Download _tkinter.pyd, tkinter package, and Tcl/Tk DLLs from the official Python nuget package and copy them into the embedded Python directory. This enables the screen overlay visualization during calibration in the portable build.
This commit is contained in:
@@ -85,6 +85,74 @@ if ! grep -q '\.\./app/src' "$PTH_FILE"; then
|
||||
fi
|
||||
echo " Patched $(basename "$PTH_FILE")"
|
||||
|
||||
# ── Bundle tkinter into embedded Python ───────────────────────
|
||||
# Embedded Python doesn't include tkinter. We download it from the
|
||||
# official Windows Python nuget package (same version) which contains
|
||||
# the _tkinter.pyd, tkinter/ package, and Tcl/Tk DLLs.
|
||||
|
||||
echo "[3b/8] Bundling tkinter for screen overlay support..."
|
||||
|
||||
# Python minor version for nuget package (e.g., 3.11.9 -> 3.11)
|
||||
PYTHON_MINOR="${PYTHON_VERSION%.*}"
|
||||
|
||||
# Download the full Python nuget package (contains all stdlib + DLLs)
|
||||
NUGET_URL="https://www.nuget.org/api/v2/package/python/${PYTHON_VERSION}"
|
||||
NUGET_PKG="$BUILD_DIR/python-nuget.zip"
|
||||
if [ ! -f "$NUGET_PKG" ]; then
|
||||
curl -sL "$NUGET_URL" -o "$NUGET_PKG"
|
||||
fi
|
||||
|
||||
NUGET_DIR="$BUILD_DIR/python-nuget"
|
||||
rm -rf "$NUGET_DIR"
|
||||
mkdir -p "$NUGET_DIR"
|
||||
unzip -qo "$NUGET_PKG" -d "$NUGET_DIR"
|
||||
|
||||
# Copy _tkinter.pyd (the C extension)
|
||||
TKINTER_PYD=$(find "$NUGET_DIR" -name "_tkinter.pyd" | head -1)
|
||||
if [ -n "$TKINTER_PYD" ]; then
|
||||
cp "$TKINTER_PYD" "$PYTHON_DIR/"
|
||||
echo " Copied _tkinter.pyd"
|
||||
else
|
||||
echo " WARNING: _tkinter.pyd not found in nuget package"
|
||||
fi
|
||||
|
||||
# Copy tkinter Python package from the stdlib zip or Lib/
|
||||
# The nuget package has Lib/tkinter/
|
||||
TKINTER_PKG=$(find "$NUGET_DIR" -type d -name "tkinter" | head -1)
|
||||
if [ -n "$TKINTER_PKG" ]; then
|
||||
mkdir -p "$PYTHON_DIR/Lib"
|
||||
cp -r "$TKINTER_PKG" "$PYTHON_DIR/Lib/tkinter"
|
||||
echo " Copied tkinter/ package"
|
||||
else
|
||||
echo " WARNING: tkinter package not found in nuget package"
|
||||
fi
|
||||
|
||||
# Copy Tcl/Tk DLLs (tcl86t.dll, tk86t.dll, etc.)
|
||||
for dll in tcl86t.dll tk86t.dll; do
|
||||
DLL_PATH=$(find "$NUGET_DIR" -name "$dll" | head -1)
|
||||
if [ -n "$DLL_PATH" ]; then
|
||||
cp "$DLL_PATH" "$PYTHON_DIR/"
|
||||
echo " Copied $dll"
|
||||
fi
|
||||
done
|
||||
|
||||
# Copy Tcl/Tk data directories (tcl8.6, tk8.6)
|
||||
for tcldir in tcl8.6 tk8.6; do
|
||||
TCL_PATH=$(find "$NUGET_DIR" -type d -name "$tcldir" | head -1)
|
||||
if [ -n "$TCL_PATH" ]; then
|
||||
cp -r "$TCL_PATH" "$PYTHON_DIR/$tcldir"
|
||||
echo " Copied $tcldir/"
|
||||
fi
|
||||
done
|
||||
|
||||
# Add Lib to ._pth so tkinter package is importable
|
||||
if ! grep -q '^Lib$' "$PTH_FILE"; then
|
||||
echo 'Lib' >> "$PTH_FILE"
|
||||
fi
|
||||
|
||||
rm -rf "$NUGET_DIR"
|
||||
echo " tkinter bundled successfully"
|
||||
|
||||
# ── Download pip and install into embedded Python ────────────
|
||||
|
||||
echo "[4/8] Installing pip into embedded Python..."
|
||||
|
||||
Reference in New Issue
Block a user