···4242 nativeBuildInputs =
4343 optional (stdenv.hostPlatform != stdenv.buildPlatform) buildPackages.python3;
44444545+ hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false);
4646+4547in stdenv.mkDerivation {
4648 name = "python3-${version}";
4749 pythonVersion = majorVersion;
···7779 })
7880 ] ++ optionals (x11Support && stdenv.isDarwin) [
7981 ./use-correct-tcl-tk-on-darwin.patch
8282+ ] ++ optionals hasDistutilsCxxPatch [
8383+ # Fix for http://bugs.python.org/issue1222585
8484+ # Upstream distutils is calling C compiler to compile C++ code, which
8585+ # only works for GCC and Apple Clang. This makes distutils to call C++
8686+ # compiler when needed.
8787+ (fetchpatch {
8888+ url = "https://bugs.python.org/file47046/python-3.x-distutils-C++.patch";
8989+ sha256 = "0dgdn9k2kmw4wh90vdnjcrnn97ylxgx7mbn9l87fwz6j501jqvk8";
9090+ extraPrefix = "";
9191+ })
8092 ];
81938294 postPatch = ''
···189201 passthru = let
190202 pythonPackages = callPackage ../../../../../top-level/python-packages.nix {python=self; overrides=packageOverrides;};
191203 in rec {
192192- inherit libPrefix sitePackages x11Support;
204204+ inherit libPrefix sitePackages x11Support hasDistutilsCxxPatch;
193205 executable = "${libPrefix}m";
194206 buildEnv = callPackage ../../wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; };
195207 withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;};
+3-2
pkgs/development/python-modules/numpy/default.nix
···1414 buildInputs = [ gfortran nose blas ];
15151616 patches = lib.optionals (python.hasDistutilsCxxPatch or false) [
1717- # See cpython 2.7 patches.
1818- # numpy.distutils is used by cython during it's check phase
1717+ # We patch cpython/distutils to fix https://bugs.python.org/issue1222585
1818+ # Patching of numpy.distutils is needed to prevent it from undoing the
1919+ # patch to distutils.
1920 ./numpy-distutils-C++.patch
2021 ];
2122