diff options
Diffstat (limited to 'pkgs/development/python-modules/sip/4.x.nix')
-rw-r--r-- | pkgs/development/python-modules/sip/4.x.nix | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/pkgs/development/python-modules/sip/4.x.nix b/pkgs/development/python-modules/sip/4.x.nix index 9c89a01797e72..e9305188ca6b7 100644 --- a/pkgs/development/python-modules/sip/4.x.nix +++ b/pkgs/development/python-modules/sip/4.x.nix @@ -1,12 +1,22 @@ -{ lib, fetchurl, fetchpatch, buildPythonPackage, python, isPyPy, pythonAtLeast, sip-module ? "sip" }: +{ + lib, + fetchurl, + fetchpatch, + buildPythonPackage, + python, + isPyPy, + pythonAtLeast, + pythonOlder, + sip-module ? "sip", + setuptools, +}: buildPythonPackage rec { pname = sip-module; version = "4.19.25"; format = "other"; - # relies on distutils - disabled = isPyPy || pythonAtLeast "3.12"; + disabled = isPyPy; src = fetchurl { url = "https://www.riverbankcomputing.com/static/Downloads/sip/${version}/sip-${version}.tar.gz"; @@ -21,6 +31,12 @@ buildPythonPackage rec { }) ]; + postPatch = lib.optionalString (pythonAtLeast "3.12") '' + substituteInPlace configure.py --replace-fail "from distutils" "from setuptools._distutils" + ''; + + propagatedBuildInputs = lib.optional (pythonAtLeast "3.12") setuptools; + configurePhase = '' ${python.executable} ./configure.py \ --sip-module ${sip-module} \ @@ -30,16 +46,28 @@ buildPythonPackage rec { enableParallelBuilding = true; - pythonImportsCheck = [ sip-module "sipconfig" ]; + pythonImportsCheck = [ + # https://www.riverbankcomputing.com/pipermail/pyqt/2023-January/045094.html + # the import check for "sip" will fail, as it segfaults as the interperter is shutting down. + # This is an upstream bug with sip4 on python3.12, and happens in the ubuntu packages version as well. + # As the pacakge works fine until exit, just remove the import check for now. + # See discussion at https://github.com/NixOS/nixpkgs/pull/327976#discussion_r1706488319 + (lib.optional (pythonOlder "3.12") sip-module) + + "sipconfig" + ]; doCheck = true; meta = with lib; { description = "Creates C++ bindings for Python modules"; mainProgram = "sip"; - homepage = "https://riverbankcomputing.com/"; - license = licenses.gpl2Plus; - maintainers = with maintainers; [ lovek323 sander ]; - platforms = platforms.all; + homepage = "https://riverbankcomputing.com/"; + license = licenses.gpl2Plus; + maintainers = with maintainers; [ + lovek323 + sander + ]; + platforms = platforms.all; }; } |