fix: extract tkinter from Python installer via 7z, fix NSIS icon path
Some checks failed
Build Release / create-release (push) Successful in 1s
Lint & Test / test (push) Failing after 15s
Build Release / build-linux (push) Successful in 1m20s
Build Release / build-docker (push) Failing after 9s
Build Release / build-windows (push) Successful in 3m19s
Some checks failed
Build Release / create-release (push) Successful in 1s
Lint & Test / test (push) Failing after 15s
Build Release / build-linux (push) Successful in 1m20s
Build Release / build-docker (push) Failing after 9s
Build Release / build-windows (push) Successful in 3m19s
- Replace nuget approach (doesn't contain tkinter) with extracting from the official Python amd64.exe installer using 7z - Remove MUI_ICON/MUI_UNICON (no .ico file available, use NSIS default) - Add p7zip-full to CI dependencies
This commit is contained in:
@@ -63,7 +63,7 @@ jobs:
|
|||||||
- name: Install system dependencies
|
- name: Install system dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y --no-install-recommends zip libportaudio2 nsis
|
sudo apt-get install -y --no-install-recommends zip libportaudio2 nsis p7zip-full
|
||||||
|
|
||||||
- name: Cross-build Windows distribution
|
- name: Cross-build Windows distribution
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -86,72 +86,87 @@ fi
|
|||||||
echo " Patched $(basename "$PTH_FILE")"
|
echo " Patched $(basename "$PTH_FILE")"
|
||||||
|
|
||||||
# ── Bundle tkinter into embedded Python ───────────────────────
|
# ── Bundle tkinter into embedded Python ───────────────────────
|
||||||
# Embedded Python doesn't include tkinter. We download it from the
|
# Embedded Python doesn't include tkinter. We extract it from the
|
||||||
# official Windows Python nuget package (same version) which contains
|
# official Windows installer (amd64.exe) which contains all components
|
||||||
# the _tkinter.pyd, tkinter/ package, and Tcl/Tk DLLs.
|
# as MSI cab files.
|
||||||
|
|
||||||
echo "[3b/8] Bundling tkinter for screen overlay support..."
|
echo "[3b/8] Bundling tkinter for screen overlay support..."
|
||||||
|
|
||||||
# Python minor version for nuget package (e.g., 3.11.9 -> 3.11)
|
# Download the Windows installer (not the embed zip — the full one)
|
||||||
PYTHON_MINOR="${PYTHON_VERSION%.*}"
|
INSTALLER_URL="https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}-amd64.exe"
|
||||||
|
INSTALLER_PATH="$BUILD_DIR/python-installer.exe"
|
||||||
# Download the full Python nuget package (contains all stdlib + DLLs)
|
if [ ! -f "$INSTALLER_PATH" ]; then
|
||||||
NUGET_URL="https://www.nuget.org/api/v2/package/python/${PYTHON_VERSION}"
|
curl -sL "$INSTALLER_URL" -o "$INSTALLER_PATH"
|
||||||
NUGET_PKG="$BUILD_DIR/python-nuget.zip"
|
|
||||||
if [ ! -f "$NUGET_PKG" ]; then
|
|
||||||
curl -sL "$NUGET_URL" -o "$NUGET_PKG"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
NUGET_DIR="$BUILD_DIR/python-nuget"
|
# The installer is a bundle of MSI/CAB files. We can extract with 7z or
|
||||||
rm -rf "$NUGET_DIR"
|
# msiextract. The tkinter components are in the 'tcltk' feature.
|
||||||
mkdir -p "$NUGET_DIR"
|
TK_EXTRACT="$BUILD_DIR/tk-extract"
|
||||||
unzip -qo "$NUGET_PKG" -d "$NUGET_DIR"
|
rm -rf "$TK_EXTRACT"
|
||||||
|
mkdir -p "$TK_EXTRACT"
|
||||||
|
|
||||||
# Copy _tkinter.pyd (the C extension)
|
if command -v 7z &>/dev/null; then
|
||||||
TKINTER_PYD=$(find "$NUGET_DIR" -name "_tkinter.pyd" | head -1)
|
# Extract all cab files from the installer
|
||||||
if [ -n "$TKINTER_PYD" ]; then
|
7z x -o"$TK_EXTRACT/installer" "$INSTALLER_PATH" -y >/dev/null 2>&1 || true
|
||||||
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/
|
# Find and extract the tcltk cab
|
||||||
# The nuget package has Lib/tkinter/
|
for cab in "$TK_EXTRACT/installer"/tcltk*.msi "$TK_EXTRACT/installer"/tcltk*; do
|
||||||
TKINTER_PKG=$(find "$NUGET_DIR" -type d -name "tkinter" | head -1)
|
[ -f "$cab" ] || continue
|
||||||
if [ -n "$TKINTER_PKG" ]; then
|
7z x -o"$TK_EXTRACT/tcltk" "$cab" -y >/dev/null 2>&1 || true
|
||||||
mkdir -p "$PYTHON_DIR/Lib"
|
done
|
||||||
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.)
|
# Find and extract the lib cab (contains tkinter Python package)
|
||||||
for dll in tcl86t.dll tk86t.dll; do
|
for cab in "$TK_EXTRACT/installer"/lib*.msi "$TK_EXTRACT/installer"/lib*; do
|
||||||
DLL_PATH=$(find "$NUGET_DIR" -name "$dll" | head -1)
|
[ -f "$cab" ] || continue
|
||||||
if [ -n "$DLL_PATH" ]; then
|
7z x -o"$TK_EXTRACT/lib" "$cab" -y >/dev/null 2>&1 || true
|
||||||
cp "$DLL_PATH" "$PYTHON_DIR/"
|
done
|
||||||
echo " Copied $dll"
|
|
||||||
|
# Copy _tkinter.pyd
|
||||||
|
TKINTER_PYD=$(find "$TK_EXTRACT" -name "_tkinter.pyd" 2>/dev/null | head -1)
|
||||||
|
if [ -n "$TKINTER_PYD" ]; then
|
||||||
|
cp "$TKINTER_PYD" "$PYTHON_DIR/DLLs/" 2>/dev/null || cp "$TKINTER_PYD" "$PYTHON_DIR/"
|
||||||
|
echo " Copied _tkinter.pyd"
|
||||||
|
else
|
||||||
|
echo " WARNING: _tkinter.pyd not found"
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
|
|
||||||
# Copy Tcl/Tk data directories (tcl8.6, tk8.6)
|
# Copy Tcl/Tk DLLs
|
||||||
for tcldir in tcl8.6 tk8.6; do
|
for dll in tcl86t.dll tk86t.dll zlib1.dll; do
|
||||||
TCL_PATH=$(find "$NUGET_DIR" -type d -name "$tcldir" | head -1)
|
DLL_PATH=$(find "$TK_EXTRACT" -name "$dll" 2>/dev/null | head -1)
|
||||||
if [ -n "$TCL_PATH" ]; then
|
if [ -n "$DLL_PATH" ]; then
|
||||||
cp -r "$TCL_PATH" "$PYTHON_DIR/$tcldir"
|
cp "$DLL_PATH" "$PYTHON_DIR/"
|
||||||
echo " Copied $tcldir/"
|
echo " Copied $dll"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Copy tkinter Python package
|
||||||
|
TKINTER_PKG=$(find "$TK_EXTRACT" -type d -name "tkinter" 2>/dev/null | head -1)
|
||||||
|
if [ -n "$TKINTER_PKG" ]; then
|
||||||
|
mkdir -p "$PYTHON_DIR/Lib"
|
||||||
|
cp -r "$TKINTER_PKG" "$PYTHON_DIR/Lib/tkinter"
|
||||||
|
echo " Copied tkinter/ package"
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
|
# Copy tcl/tk data directories
|
||||||
|
for tcldir in tcl8.6 tk8.6; do
|
||||||
|
TCL_PATH=$(find "$TK_EXTRACT" -type d -name "$tcldir" 2>/dev/null | head -1)
|
||||||
|
if [ -n "$TCL_PATH" ]; then
|
||||||
|
cp -r "$TCL_PATH" "$PYTHON_DIR/$tcldir"
|
||||||
|
echo " Copied $tcldir/"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo " tkinter bundled successfully"
|
||||||
|
else
|
||||||
|
echo " WARNING: 7z not found — skipping tkinter bundling (install p7zip-full)"
|
||||||
|
fi
|
||||||
|
|
||||||
# Add Lib to ._pth so tkinter package is importable
|
# Add Lib to ._pth so tkinter package is importable
|
||||||
if ! grep -q '^Lib$' "$PTH_FILE"; then
|
if ! grep -q '^Lib$' "$PTH_FILE"; then
|
||||||
echo 'Lib' >> "$PTH_FILE"
|
echo 'Lib' >> "$PTH_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf "$NUGET_DIR"
|
rm -rf "$TK_EXTRACT"
|
||||||
echo " tkinter bundled successfully"
|
|
||||||
|
|
||||||
# ── Download pip and install into embedded Python ────────────
|
# ── Download pip and install into embedded Python ────────────
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ SetCompressor /SOLID lzma
|
|||||||
; ── Modern UI Configuration ─────────────────────────────────
|
; ── Modern UI Configuration ─────────────────────────────────
|
||||||
|
|
||||||
!define MUI_ABORTWARNING
|
!define MUI_ABORTWARNING
|
||||||
!define MUI_ICON "server\src\wled_controller\static\icon-192.png"
|
|
||||||
!define MUI_UNICON "server\src\wled_controller\static\icon-192.png"
|
|
||||||
|
|
||||||
; ── Pages ───────────────────────────────────────────────────
|
; ── Pages ───────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user