lol

Merge pull request #39576 from veprbl/pr/py3_distutils_fix

python3: add C++ compiler support for distutils

authored by

Matthew Justin Bauer and committed by
GitHub
1d3fe7d8 03308d12

+43 -6
+14 -2
pkgs/development/interpreters/python/cpython/3.4/default.nix
··· 1 - { stdenv, fetchurl 1 + { stdenv, fetchurl, fetchpatch 2 2 , bzip2 3 3 , expat 4 4 , libffi ··· 39 39 ++ optionals x11Support [ tcl tk libX11 xproto ] 40 40 ++ optionals stdenv.isDarwin [ CF configd ]; 41 41 42 + hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false); 43 + 42 44 in stdenv.mkDerivation { 43 45 name = "python3-${version}"; 44 46 pythonVersion = majorVersion; ··· 69 71 ./ld_library_path.patch 70 72 ] ++ optionals (x11Support && stdenv.isDarwin) [ 71 73 ./use-correct-tcl-tk-on-darwin.patch 74 + ] ++ optionals hasDistutilsCxxPatch [ 75 + # Fix for http://bugs.python.org/issue1222585 76 + # Upstream distutils is calling C compiler to compile C++ code, which 77 + # only works for GCC and Apple Clang. This makes distutils to call C++ 78 + # compiler when needed. 79 + (fetchpatch { 80 + url = "https://bugs.python.org/file47046/python-3.x-distutils-C++.patch"; 81 + sha256 = "0dgdn9k2kmw4wh90vdnjcrnn97ylxgx7mbn9l87fwz6j501jqvk8"; 82 + extraPrefix = ""; 83 + }) 72 84 ]; 73 85 74 86 postPatch = '' ··· 166 178 passthru = let 167 179 pythonPackages = callPackage ../../../../../top-level/python-packages.nix {python=self; overrides=packageOverrides;}; 168 180 in rec { 169 - inherit libPrefix sitePackages x11Support; 181 + inherit libPrefix sitePackages x11Support hasDistutilsCxxPatch; 170 182 executable = "${libPrefix}m"; 171 183 buildEnv = callPackage ../../wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; }; 172 184 withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;};
+13 -1
pkgs/development/interpreters/python/cpython/3.5/default.nix
··· 39 39 ++ optionals x11Support [ tcl tk libX11 xproto ] 40 40 ++ optionals stdenv.isDarwin [ CF configd ]; 41 41 42 + hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false); 43 + 42 44 in stdenv.mkDerivation { 43 45 name = "python3-${version}"; 44 46 pythonVersion = majorVersion; ··· 75 77 }) 76 78 ] ++ optionals (x11Support && stdenv.isDarwin) [ 77 79 ./use-correct-tcl-tk-on-darwin.patch 80 + ] ++ optionals hasDistutilsCxxPatch [ 81 + # Fix for http://bugs.python.org/issue1222585 82 + # Upstream distutils is calling C compiler to compile C++ code, which 83 + # only works for GCC and Apple Clang. This makes distutils to call C++ 84 + # compiler when needed. 85 + (fetchpatch { 86 + url = "https://bugs.python.org/file47046/python-3.x-distutils-C++.patch"; 87 + sha256 = "0dgdn9k2kmw4wh90vdnjcrnn97ylxgx7mbn9l87fwz6j501jqvk8"; 88 + extraPrefix = ""; 89 + }) 78 90 ]; 79 91 80 92 postPatch = '' ··· 166 178 passthru = let 167 179 pythonPackages = callPackage ../../../../../top-level/python-packages.nix {python=self; overrides=packageOverrides;}; 168 180 in rec { 169 - inherit libPrefix sitePackages x11Support; 181 + inherit libPrefix sitePackages x11Support hasDistutilsCxxPatch; 170 182 executable = "${libPrefix}m"; 171 183 buildEnv = callPackage ../../wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; }; 172 184 withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;};
+13 -1
pkgs/development/interpreters/python/cpython/3.6/default.nix
··· 42 42 nativeBuildInputs = 43 43 optional (stdenv.hostPlatform != stdenv.buildPlatform) buildPackages.python3; 44 44 45 + hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false); 46 + 45 47 in stdenv.mkDerivation { 46 48 name = "python3-${version}"; 47 49 pythonVersion = majorVersion; ··· 77 79 }) 78 80 ] ++ optionals (x11Support && stdenv.isDarwin) [ 79 81 ./use-correct-tcl-tk-on-darwin.patch 82 + ] ++ optionals hasDistutilsCxxPatch [ 83 + # Fix for http://bugs.python.org/issue1222585 84 + # Upstream distutils is calling C compiler to compile C++ code, which 85 + # only works for GCC and Apple Clang. This makes distutils to call C++ 86 + # compiler when needed. 87 + (fetchpatch { 88 + url = "https://bugs.python.org/file47046/python-3.x-distutils-C++.patch"; 89 + sha256 = "0dgdn9k2kmw4wh90vdnjcrnn97ylxgx7mbn9l87fwz6j501jqvk8"; 90 + extraPrefix = ""; 91 + }) 80 92 ]; 81 93 82 94 postPatch = '' ··· 189 201 passthru = let 190 202 pythonPackages = callPackage ../../../../../top-level/python-packages.nix {python=self; overrides=packageOverrides;}; 191 203 in rec { 192 - inherit libPrefix sitePackages x11Support; 204 + inherit libPrefix sitePackages x11Support hasDistutilsCxxPatch; 193 205 executable = "${libPrefix}m"; 194 206 buildEnv = callPackage ../../wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; }; 195 207 withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;};
+3 -2
pkgs/development/python-modules/numpy/default.nix
··· 14 14 buildInputs = [ gfortran nose blas ]; 15 15 16 16 patches = lib.optionals (python.hasDistutilsCxxPatch or false) [ 17 - # See cpython 2.7 patches. 18 - # numpy.distutils is used by cython during it's check phase 17 + # We patch cpython/distutils to fix https://bugs.python.org/issue1222585 18 + # Patching of numpy.distutils is needed to prevent it from undoing the 19 + # patch to distutils. 19 20 ./numpy-distutils-C++.patch 20 21 ]; 21 22