From 7042d94f640520d444b7a81da1543cea1a5273c2 Mon Sep 17 00:00:00 2001 From: Jeremy Fleischman Date: Tue, 20 Aug 2024 10:35:33 -0700 Subject: [PATCH 1/4] python3Packages.pcbnewtransition: fix Python 3.12 build Before this change, pcbnewtransition couldn't build. It would fail with this issue already reported (and fixed!) upstream: https://github.com/yaqwsx/pcbnewTransition/issues/6 This is a blocker to get kikit building on Python 3.12: https://github.com/NixOS/nixpkgs/issues/325220 --- pkgs/development/python-modules/pcbnewtransition/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/pcbnewtransition/default.nix b/pkgs/development/python-modules/pcbnewtransition/default.nix index 03fc11db5925..79e2ef3d1624 100644 --- a/pkgs/development/python-modules/pcbnewtransition/default.nix +++ b/pkgs/development/python-modules/pcbnewtransition/default.nix @@ -8,7 +8,7 @@ }: buildPythonPackage rec { pname = "pcbnewtransition"; - version = "0.4.1"; + version = "0.4.2"; format = "setuptools"; disabled = pythonOlder "3.7"; @@ -16,7 +16,7 @@ buildPythonPackage rec { src = fetchPypi { pname = "pcbnewTransition"; inherit version; - hash = "sha256-+mRExuDuEYxSSlrkEjSyPK+RRJZo+YJH7WnUVfjblRQ="; + hash = "sha256-fFOzL80m92PcF9SC6NZ69OUuEJn1sl+mWVFjRorhS4M="; }; propagatedBuildInputs = [ kicad ]; From 5c493ae9edbc67a40c8dd48f783274c5f8807d8d Mon Sep 17 00:00:00 2001 From: Jeremy Fleischman Date: Tue, 20 Aug 2024 01:37:47 -0700 Subject: [PATCH 2/4] python3Packages.shapely_1_8: remove Shapely 1.8 is old unmaintained. We originally had to introduce it to nixpkgs in order to package kikit, but recently kikit upstream dropped the requirement to use an old version of shapely (https://github.com/yaqwsx/KiKit/issues/574#issuecomment-1879721181). Upstream relaxed the version constraint in https://github.com/yaqwsx/KiKit/commit/3427a8d6ce31eea6fb3647e550d6b4ddc0e90842, which first landed in kikit 1.5.0, which we're already packaging, so we're free to drop shapely 1.8! --- pkgs/by-name/ki/kikit/default.nix | 5 +- .../python-modules/shapely/1.8.nix | 87 ------------------- pkgs/top-level/python-packages.nix | 2 - 3 files changed, 2 insertions(+), 92 deletions(-) delete mode 100644 pkgs/development/python-modules/shapely/1.8.nix diff --git a/pkgs/by-name/ki/kikit/default.nix b/pkgs/by-name/ki/kikit/default.nix index 2f5a0bced240..caaa81315427 100644 --- a/pkgs/by-name/ki/kikit/default.nix +++ b/pkgs/by-name/ki/kikit/default.nix @@ -17,7 +17,7 @@ , pcbnewtransition , pybars3 , versioneer -, shapely_1_8 +, shapely }: let solidpython = callPackage ./solidpython { }; @@ -49,8 +49,7 @@ buildPythonApplication rec { wxpython pcbnewtransition pybars3 - # https://github.com/yaqwsx/KiKit/issues/574 - shapely_1_8 + shapely # https://github.com/yaqwsx/KiKit/issues/576 solidpython ]; diff --git a/pkgs/development/python-modules/shapely/1.8.nix b/pkgs/development/python-modules/shapely/1.8.nix deleted file mode 100644 index 95ce815bd2ed..000000000000 --- a/pkgs/development/python-modules/shapely/1.8.nix +++ /dev/null @@ -1,87 +0,0 @@ -{ - lib, - stdenv, - buildPythonPackage, - fetchPypi, - pytestCheckHook, - pythonOlder, - substituteAll, - - cython_0, - geos_3_11, - numpy, - oldest-supported-numpy, - setuptools, - wheel, -}: - -buildPythonPackage rec { - pname = "shapely"; - version = "1.8.5"; - pyproject = true; - - disabled = pythonOlder "3.7"; - - src = fetchPypi { - pname = "Shapely"; - inherit version; - hash = "sha256-6CttYOz7EkEgyI/hBqR4WWu+qxQhFtfn9ko2TayQKpI="; - }; - - # Environment variable used in shapely/_buildcfg.py - GEOS_LIBRARY_PATH = "${geos_3_11}/lib/libgeos_c${stdenv.hostPlatform.extensions.sharedLibrary}"; - - patches = [ - # Patch to search form GOES .so/.dylib files in a Nix-aware way - (substituteAll { - src = ./library-paths.patch; - libgeos_c = GEOS_LIBRARY_PATH; - libc = lib.optionalString ( - !stdenv.isDarwin - ) "${stdenv.cc.libc}/lib/libc${stdenv.hostPlatform.extensions.sharedLibrary}.6"; - }) - ]; - - postPatch = '' - substituteInPlace pyproject.toml --replace "setuptools<64" "setuptools" - ''; - - nativeBuildInputs = [ - cython_0 - geos_3_11 # for geos-config - oldest-supported-numpy - setuptools - wheel - ]; - - buildInputs = [ geos_3_11 ]; - - propagatedBuildInputs = [ numpy ]; - - nativeCheckInputs = [ pytestCheckHook ]; - - preCheck = '' - rm -r shapely # prevent import of local shapely - ''; - - disabledTests = lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ - # FIXME(lf-): these logging tests are broken, which is definitely our - # fault. I've tried figuring out the cause and failed. - # - # It is apparently some sandbox or no-sandbox related thing on macOS only - # though. - "test_error_handler_exception" - "test_error_handler" - "test_info_handler" - ]; - - pythonImportsCheck = [ "shapely" ]; - - meta = with lib; { - changelog = "https://github.com/shapely/shapely/blob/${version}/CHANGES.txt"; - description = "Manipulation and analysis of geometric objects"; - homepage = "https://github.com/shapely/shapely"; - license = licenses.bsd3; - maintainers = teams.geospatial.members; - }; -} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index ce3728ea525a..b8d19bd7226e 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -14364,8 +14364,6 @@ self: super: with self; { shapely = callPackage ../development/python-modules/shapely { }; - shapely_1_8 = callPackage ../development/python-modules/shapely/1.8.nix { }; - shaperglot = callPackage ../development/python-modules/shaperglot { }; sharedmem = callPackage ../development/python-modules/sharedmem { }; From 3fc660733babd8a600c83be0daa4dc29faf584a7 Mon Sep 17 00:00:00 2001 From: Jeremy Fleischman Date: Tue, 20 Aug 2024 10:43:07 -0700 Subject: [PATCH 3/4] kikit: 1.5.0 -> 1.6.0 kikit 1.5.0 bundles an old version of versioneer that doesn't work with Python 3.12. See this usptream issue for details: https://github.com/yaqwsx/KiKit/issues/680 This was fixed in https://github.com/yaqwsx/KiKit/commit/e0c312ae105c8d2a4626b83ac86324b1a1be75ba, which first landed in kikit 1.6.0. So, let's upgrade and finally get this building on Python 3.12! This fixes https://github.com/NixOS/nixpkgs/issues/325220 --- pkgs/by-name/ki/kikit/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/ki/kikit/default.nix b/pkgs/by-name/ki/kikit/default.nix index caaa81315427..49bef476bccd 100644 --- a/pkgs/by-name/ki/kikit/default.nix +++ b/pkgs/by-name/ki/kikit/default.nix @@ -24,7 +24,7 @@ let in buildPythonApplication rec { pname = "kikit"; - version = "1.5.0"; + version = "1.6.0"; format = "setuptools"; disabled = pythonOlder "3.7"; @@ -33,7 +33,7 @@ buildPythonApplication rec { owner = "yaqwsx"; repo = "KiKit"; rev = "refs/tags/v${version}"; - hash = "sha256-f8FB6EEy9Ch4LcMKd9PADXV9QrSb7e22Ui86G6AnQKE="; + hash = "sha256-r8LQcy3I6hmcrU/6HfPAYJd+cEZdhad6DUldC9HvXZU="; }; propagatedBuildInputs = [ From d045216e9c0595cc44be18e7cc79372062e0448f Mon Sep 17 00:00:00 2001 From: Jeremy Fleischman Date: Tue, 20 Aug 2024 10:52:36 -0700 Subject: [PATCH 4/4] kicad: use python 3.12 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 6cec87c32d0dabb868da784734192c651d1db9df. Now that https://github.com/NixOS/nixpkgs/pull/326142 has landed, there's no reason to keep ourselves pinned to Python 3.11 anymore. As a happy side effect, this also fixes a bug with 6cec87c32d0dabb868da784734192c651d1db9df which broke our ability to use kicad addons: $ nix build --impure --expr 'with import ./. {}; pkgs.kicad.override { addons = with pkgs.kicadAddons; [kikit kikit-library]; }' -L ... error: … while calling the 'derivationStrict' builtin at :34:12: 33| 34| strict = derivationStrict drvAttrs; | ^ 35| … while evaluating derivation 'kicad-8.0.4' whose name attribute is located at /home/jeremy/src/github.com/NixOS/nixpkgs-alt/pkgs/stdenv/generic/make-derivation.nix:336:7 … while evaluating attribute 'makeWrapperArgs' of derivation 'kicad-8.0.4' at /home/jeremy/src/github.com/NixOS/nixpkgs-alt/pkgs/applications/science/electronics/kicad/default.nix:201:3: 200| # We are emulating wrapGAppsHook3, along with other variables to the wrapper 201| makeWrapperArgs = with passthru.libraries; [ | ^ 202| "--prefix XDG_DATA_DIRS : ${base}/share" (stack trace truncated; use '--show-trace' to show the full, detailed trace) error: function 'anonymous lambda' called with unexpected argument 'python' at /home/jeremy/src/github.com/NixOS/nixpkgs-alt/pkgs/applications/science/electronics/kicad/addons/kikit.nix:2:1: 1| # For building the multiple addons that are in the kikit repo. 2| { stdenv | ^ 3| , bc Did you mean python3? --- .../science/electronics/kicad/default.nix | 12 ++++-------- pkgs/top-level/python-packages.nix | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/pkgs/applications/science/electronics/kicad/default.nix b/pkgs/applications/science/electronics/kicad/default.nix index 459523ea6169..4dd8fa743121 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 -, python311 +, python3 , addons ? [ ] , debug ? false , sanitizeAddress ? false @@ -122,14 +122,10 @@ let else versionsImport.${baseName}.libVersion.version; wxGTK = wxGTK32; - # 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; + python = python3; wxPython = python.pkgs.wxpython; addonPath = "addon.zip"; - addonsDrvs = map (pkg: pkg.override { inherit addonPath python; }) addons; + addonsDrvs = map (pkg: pkg.override { inherit addonPath python3; }) addons; addonsJoined = runCommand "addonsJoined" @@ -161,7 +157,7 @@ stdenv.mkDerivation rec { # Common libraries, referenced during runtime, via the wrapper. passthru.libraries = callPackages ./libraries.nix { inherit libSrc; }; - passthru.callPackage = newScope { inherit addonPath python; }; + passthru.callPackage = newScope { inherit addonPath python3; }; 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 b8d19bd7226e..8c379a5c1e2d 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -6663,7 +6663,7 @@ self: super: with self; { khanaa = callPackage ../development/python-modules/khanaa {}; kicad = toPythonModule (pkgs.kicad.override { - python311 = python; + python3 = python; }).src; kinparse = callPackage ../development/python-modules/kinparse { };