From 8fa36fc8a18261a2195bc2ae5384a320fe97c6a9 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Wed, 17 Apr 2019 22:57:20 -0400 Subject: [PATCH] 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. --- pkgs/development/interpreters/python/cpython/2.7/default.nix | 2 +- pkgs/development/interpreters/python/cpython/default.nix | 2 +- pkgs/development/interpreters/python/default.nix | 3 ++- pkgs/development/interpreters/python/pypy/default.nix | 1 + pkgs/development/interpreters/python/pypy/prebuilt.nix | 1 + pkgs/development/python-modules/numpy/default.nix | 2 +- 6 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pkgs/development/interpreters/python/cpython/2.7/default.nix b/pkgs/development/interpreters/python/cpython/2.7/default.nix index 505929df8ef..894a9b084c6 100644 --- a/pkgs/development/interpreters/python/cpython/2.7/default.nix +++ b/pkgs/development/interpreters/python/cpython/2.7/default.nix @@ -42,7 +42,7 @@ let executable = libPrefix; pythonVersion = with sourceVersion; "${major}.${minor}"; sitePackages = "lib/${libPrefix}/site-packages"; - inherit pythonForBuild; + inherit hasDistutilsCxxPatch pythonForBuild; } // { inherit ucsEncoding; }; diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index 7d90e201d19..60ea3bdf4c7 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -39,7 +39,7 @@ let executable = libPrefix; pythonVersion = with sourceVersion; "${major}.${minor}"; sitePackages = "lib/${libPrefix}/site-packages"; - inherit pythonForBuild; + inherit hasDistutilsCxxPatch pythonForBuild; }; version = with sourceVersion; "${major}.${minor}.${patch}${suffix}"; diff --git a/pkgs/development/interpreters/python/default.nix b/pkgs/development/interpreters/python/default.nix index ef4cab35021..119c0a2728b 100644 --- a/pkgs/development/interpreters/python/default.nix +++ b/pkgs/development/interpreters/python/default.nix @@ -13,6 +13,7 @@ with pkgs; , pythonVersion , packageOverrides , sitePackages + , hasDistutilsCxxPatch , pythonForBuild , self }: let @@ -40,7 +41,7 @@ with pkgs; inherit sourceVersion; pythonAtLeast = lib.versionAtLeast pythonVersion; pythonOlder = lib.versionOlder pythonVersion; - inherit pythonForBuild; + inherit hasDistutilsCxxPatch pythonForBuild; }; in { diff --git a/pkgs/development/interpreters/python/pypy/default.nix b/pkgs/development/interpreters/python/pypy/default.nix index 46cf0475de4..3cdc30b9234 100644 --- a/pkgs/development/interpreters/python/pypy/default.nix +++ b/pkgs/development/interpreters/python/pypy/default.nix @@ -24,6 +24,7 @@ let executable = "pypy${if isPy3k then "3" else ""}"; pythonForBuild = self; # No cross-compiling for now. sitePackages = "site-packages"; + hasDistutilsCxxPatch = false; }; pname = passthru.executable; version = with sourceVersion; "${major}.${minor}.${patch}"; diff --git a/pkgs/development/interpreters/python/pypy/prebuilt.nix b/pkgs/development/interpreters/python/pypy/prebuilt.nix index ee556ba05bf..552f230ee71 100644 --- a/pkgs/development/interpreters/python/pypy/prebuilt.nix +++ b/pkgs/development/interpreters/python/pypy/prebuilt.nix @@ -34,6 +34,7 @@ let executable = "pypy${if isPy3k then "3" else ""}"; pythonForBuild = self; # Not possible to cross-compile with. sitePackages = "site-packages"; + hasDistutilsCxxPatch = false; }; pname = "${passthru.executable}_prebuilt"; version = with sourceVersion; "${major}.${minor}.${patch}"; diff --git a/pkgs/development/python-modules/numpy/default.nix b/pkgs/development/python-modules/numpy/default.nix index 8a7deb934ae..171496584ef 100644 --- a/pkgs/development/python-modules/numpy/default.nix +++ b/pkgs/development/python-modules/numpy/default.nix @@ -27,7 +27,7 @@ in buildPythonPackage rec { nativeBuildInputs = [ gfortran pytest ]; 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 # Patching of numpy.distutils is needed to prevent it from undoing the # patch to distutils.