python: provide hasCxxDistutils attribute for pythonPackages.numpy

Patching numpy.distutils used to be required for pythonPackages.cython
to build on darwin. It was later accidentally disabled during one of the
refactorings, but that did not break cython. This change reinstantiates
the patch. It still applies, so it should be low maintenance and it can
still be useful.
This commit is contained in:
Dmitry Kalinkin
2019-04-28 09:17:59 +02:00
committed by Frederik Rietdijk
parent e1502a8be2
commit 8fa36fc8a1
6 changed files with 7 additions and 4 deletions
@@ -42,7 +42,7 @@ let
executable = libPrefix; executable = libPrefix;
pythonVersion = with sourceVersion; "${major}.${minor}"; pythonVersion = with sourceVersion; "${major}.${minor}";
sitePackages = "lib/${libPrefix}/site-packages"; sitePackages = "lib/${libPrefix}/site-packages";
inherit pythonForBuild; inherit hasDistutilsCxxPatch pythonForBuild;
} // { } // {
inherit ucsEncoding; inherit ucsEncoding;
}; };
@@ -39,7 +39,7 @@ let
executable = libPrefix; executable = libPrefix;
pythonVersion = with sourceVersion; "${major}.${minor}"; pythonVersion = with sourceVersion; "${major}.${minor}";
sitePackages = "lib/${libPrefix}/site-packages"; sitePackages = "lib/${libPrefix}/site-packages";
inherit pythonForBuild; inherit hasDistutilsCxxPatch pythonForBuild;
}; };
version = with sourceVersion; "${major}.${minor}.${patch}${suffix}"; version = with sourceVersion; "${major}.${minor}.${patch}${suffix}";
@@ -13,6 +13,7 @@ with pkgs;
, pythonVersion , pythonVersion
, packageOverrides , packageOverrides
, sitePackages , sitePackages
, hasDistutilsCxxPatch
, pythonForBuild , pythonForBuild
, self , self
}: let }: let
@@ -40,7 +41,7 @@ with pkgs;
inherit sourceVersion; inherit sourceVersion;
pythonAtLeast = lib.versionAtLeast pythonVersion; pythonAtLeast = lib.versionAtLeast pythonVersion;
pythonOlder = lib.versionOlder pythonVersion; pythonOlder = lib.versionOlder pythonVersion;
inherit pythonForBuild; inherit hasDistutilsCxxPatch pythonForBuild;
}; };
in { in {
@@ -24,6 +24,7 @@ let
executable = "pypy${if isPy3k then "3" else ""}"; executable = "pypy${if isPy3k then "3" else ""}";
pythonForBuild = self; # No cross-compiling for now. pythonForBuild = self; # No cross-compiling for now.
sitePackages = "site-packages"; sitePackages = "site-packages";
hasDistutilsCxxPatch = false;
}; };
pname = passthru.executable; pname = passthru.executable;
version = with sourceVersion; "${major}.${minor}.${patch}"; version = with sourceVersion; "${major}.${minor}.${patch}";
@@ -34,6 +34,7 @@ let
executable = "pypy${if isPy3k then "3" else ""}"; executable = "pypy${if isPy3k then "3" else ""}";
pythonForBuild = self; # Not possible to cross-compile with. pythonForBuild = self; # Not possible to cross-compile with.
sitePackages = "site-packages"; sitePackages = "site-packages";
hasDistutilsCxxPatch = false;
}; };
pname = "${passthru.executable}_prebuilt"; pname = "${passthru.executable}_prebuilt";
version = with sourceVersion; "${major}.${minor}.${patch}"; version = with sourceVersion; "${major}.${minor}.${patch}";
@@ -27,7 +27,7 @@ in buildPythonPackage rec {
nativeBuildInputs = [ gfortran pytest ]; nativeBuildInputs = [ gfortran pytest ];
buildInputs = [ blas ]; buildInputs = [ blas ];
patches = lib.optionals (python.hasDistutilsCxxPatch or false) [ patches = lib.optionals python.hasDistutilsCxxPatch [
# We patch cpython/distutils to fix https://bugs.python.org/issue1222585 # We patch cpython/distutils to fix https://bugs.python.org/issue1222585
# Patching of numpy.distutils is needed to prevent it from undoing the # Patching of numpy.distutils is needed to prevent it from undoing the
# patch to distutils. # patch to distutils.