From 3abfb075bc88df9c5ca6062fb37d3ff93ea75609 Mon Sep 17 00:00:00 2001 From: "Dr.-Ing. Amilcar do Carmo Lucas" Date: Fri, 28 Aug 2026 15:46:59 +0200 Subject: [PATCH] build: rely on PyInstaller Tcl/Tk hook --- .github/workflows/build_windows_macos.yml | 4 ---- windows/ardupilot_methodic_configurator.spec | 22 -------------------- 2 files changed, 26 deletions(-) diff --git a/.github/workflows/build_windows_macos.yml b/.github/workflows/build_windows_macos.yml index 507bff474..44d125f87 100644 --- a/.github/workflows/build_windows_macos.yml +++ b/.github/workflows/build_windows_macos.yml @@ -86,10 +86,6 @@ jobs: cd ardupilot_methodic_configurator copy ..\\windows\\ardupilot_methodic_configurator.spec pyinstaller --clean ardupilot_methodic_configurator.spec - 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." - } del ardupilot_methodic_configurator.spec - name: Write the git commit hash to file diff --git a/windows/ardupilot_methodic_configurator.spec b/windows/ardupilot_methodic_configurator.spec index 621c78e7f..80fd83c12 100644 --- a/windows/ardupilot_methodic_configurator.spec +++ b/windows/ardupilot_methodic_configurator.spec @@ -4,28 +4,6 @@ from PyInstaller.utils.hooks import collect_submodules import certifi import os -from pathlib import Path -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] - - -# Set both variables before PyInstaller analyses tkinter so its built-in hook -# collects the library data into _tcl_data and _tk_data. Without this, the -# frozen application contains the DLLs but fails during the tkinter runtime hook. -tcl_root = Path(sys.base_prefix) / "tcl" -os.environ["TCL_LIBRARY"] = str(_find_tcl_tk_library(tcl_root, "tcl")) -os.environ["TK_LIBRARY"] = str(_find_tcl_tk_library(tcl_root, "tk")) # Path to certifi's CA bundle certifi_cacert = certifi.where()