From 6cec87c32d0dabb868da784734192c651d1db9df Mon Sep 17 00:00:00 2001 From: Christoph Honal Date: Tue, 9 Jul 2024 05:13:09 +0200 Subject: [PATCH] kicad: pin to python 3.11 KiCAD depends on wxWidgets, which still uses distutils (removed in Python 3.12) --- .../science/electronics/kicad/default.nix | 12 ++++++++---- pkgs/top-level/python-packages.nix | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/science/electronics/kicad/default.nix b/pkgs/applications/science/electronics/kicad/default.nix index 4dd8fa743121..459523ea6169 100644 --- a/pkgs/applications/science/electronics/kicad/default.nix +++ b/pkgs/applications/science/electronics/kicad/default.nix @@ -25,7 +25,7 @@ , withNgspice ? !stdenv.isDarwin , libngspice , withScripting ? true -, python3 +, python311 , addons ? [ ] , debug ? false , sanitizeAddress ? false @@ -122,10 +122,14 @@ let else versionsImport.${baseName}.libVersion.version; wxGTK = wxGTK32; - python = python3; + # KiCAD depends on wxWidgets, which uses distutils (removed in Python 3.12) + # See also: https://github.com/wxWidgets/Phoenix/issues/2104 + # Eventually, wxWidgets should support Python 3.12: https://github.com/wxWidgets/Phoenix/issues/2553 + # Until then, we use Python 3.11 which still includes distutils + python = python311; wxPython = python.pkgs.wxpython; addonPath = "addon.zip"; - addonsDrvs = map (pkg: pkg.override { inherit addonPath python3; }) addons; + addonsDrvs = map (pkg: pkg.override { inherit addonPath python; }) addons; addonsJoined = runCommand "addonsJoined" @@ -157,7 +161,7 @@ stdenv.mkDerivation rec { # Common libraries, referenced during runtime, via the wrapper. passthru.libraries = callPackages ./libraries.nix { inherit libSrc; }; - passthru.callPackage = newScope { inherit addonPath python3; }; + passthru.callPackage = newScope { inherit addonPath python; }; base = callPackage ./base.nix { inherit stable testing baseName; inherit kicadSrc kicadVersion; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 39b8b28be828..a1edca205773 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -6504,7 +6504,7 @@ self: super: with self; { khanaa = callPackage ../development/python-modules/khanaa {}; kicad = toPythonModule (pkgs.kicad.override { - python3 = python; + python311 = python; }).src; kinparse = callPackage ../development/python-modules/kinparse { };