Merge pull request #39576 from veprbl/pr/py3_distutils_fix
python3: add C++ compiler support for distutils
This commit is contained in:
commit
1d3fe7d894
@ -1,4 +1,4 @@
|
|||||||
{ stdenv, fetchurl
|
{ stdenv, fetchurl, fetchpatch
|
||||||
, bzip2
|
, bzip2
|
||||||
, expat
|
, expat
|
||||||
, libffi
|
, libffi
|
||||||
@ -39,6 +39,8 @@ let
|
|||||||
++ optionals x11Support [ tcl tk libX11 xproto ]
|
++ optionals x11Support [ tcl tk libX11 xproto ]
|
||||||
++ optionals stdenv.isDarwin [ CF configd ];
|
++ optionals stdenv.isDarwin [ CF configd ];
|
||||||
|
|
||||||
|
hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false);
|
||||||
|
|
||||||
in stdenv.mkDerivation {
|
in stdenv.mkDerivation {
|
||||||
name = "python3-${version}";
|
name = "python3-${version}";
|
||||||
pythonVersion = majorVersion;
|
pythonVersion = majorVersion;
|
||||||
@ -69,6 +71,16 @@ in stdenv.mkDerivation {
|
|||||||
./ld_library_path.patch
|
./ld_library_path.patch
|
||||||
] ++ optionals (x11Support && stdenv.isDarwin) [
|
] ++ optionals (x11Support && stdenv.isDarwin) [
|
||||||
./use-correct-tcl-tk-on-darwin.patch
|
./use-correct-tcl-tk-on-darwin.patch
|
||||||
|
] ++ optionals hasDistutilsCxxPatch [
|
||||||
|
# Fix for http://bugs.python.org/issue1222585
|
||||||
|
# Upstream distutils is calling C compiler to compile C++ code, which
|
||||||
|
# only works for GCC and Apple Clang. This makes distutils to call C++
|
||||||
|
# compiler when needed.
|
||||||
|
(fetchpatch {
|
||||||
|
url = "https://bugs.python.org/file47046/python-3.x-distutils-C++.patch";
|
||||||
|
sha256 = "0dgdn9k2kmw4wh90vdnjcrnn97ylxgx7mbn9l87fwz6j501jqvk8";
|
||||||
|
extraPrefix = "";
|
||||||
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
@ -166,7 +178,7 @@ in stdenv.mkDerivation {
|
|||||||
passthru = let
|
passthru = let
|
||||||
pythonPackages = callPackage ../../../../../top-level/python-packages.nix {python=self; overrides=packageOverrides;};
|
pythonPackages = callPackage ../../../../../top-level/python-packages.nix {python=self; overrides=packageOverrides;};
|
||||||
in rec {
|
in rec {
|
||||||
inherit libPrefix sitePackages x11Support;
|
inherit libPrefix sitePackages x11Support hasDistutilsCxxPatch;
|
||||||
executable = "${libPrefix}m";
|
executable = "${libPrefix}m";
|
||||||
buildEnv = callPackage ../../wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; };
|
buildEnv = callPackage ../../wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; };
|
||||||
withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;};
|
withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;};
|
||||||
|
@ -39,6 +39,8 @@ let
|
|||||||
++ optionals x11Support [ tcl tk libX11 xproto ]
|
++ optionals x11Support [ tcl tk libX11 xproto ]
|
||||||
++ optionals stdenv.isDarwin [ CF configd ];
|
++ optionals stdenv.isDarwin [ CF configd ];
|
||||||
|
|
||||||
|
hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false);
|
||||||
|
|
||||||
in stdenv.mkDerivation {
|
in stdenv.mkDerivation {
|
||||||
name = "python3-${version}";
|
name = "python3-${version}";
|
||||||
pythonVersion = majorVersion;
|
pythonVersion = majorVersion;
|
||||||
@ -75,6 +77,16 @@ in stdenv.mkDerivation {
|
|||||||
})
|
})
|
||||||
] ++ optionals (x11Support && stdenv.isDarwin) [
|
] ++ optionals (x11Support && stdenv.isDarwin) [
|
||||||
./use-correct-tcl-tk-on-darwin.patch
|
./use-correct-tcl-tk-on-darwin.patch
|
||||||
|
] ++ optionals hasDistutilsCxxPatch [
|
||||||
|
# Fix for http://bugs.python.org/issue1222585
|
||||||
|
# Upstream distutils is calling C compiler to compile C++ code, which
|
||||||
|
# only works for GCC and Apple Clang. This makes distutils to call C++
|
||||||
|
# compiler when needed.
|
||||||
|
(fetchpatch {
|
||||||
|
url = "https://bugs.python.org/file47046/python-3.x-distutils-C++.patch";
|
||||||
|
sha256 = "0dgdn9k2kmw4wh90vdnjcrnn97ylxgx7mbn9l87fwz6j501jqvk8";
|
||||||
|
extraPrefix = "";
|
||||||
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
@ -166,7 +178,7 @@ in stdenv.mkDerivation {
|
|||||||
passthru = let
|
passthru = let
|
||||||
pythonPackages = callPackage ../../../../../top-level/python-packages.nix {python=self; overrides=packageOverrides;};
|
pythonPackages = callPackage ../../../../../top-level/python-packages.nix {python=self; overrides=packageOverrides;};
|
||||||
in rec {
|
in rec {
|
||||||
inherit libPrefix sitePackages x11Support;
|
inherit libPrefix sitePackages x11Support hasDistutilsCxxPatch;
|
||||||
executable = "${libPrefix}m";
|
executable = "${libPrefix}m";
|
||||||
buildEnv = callPackage ../../wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; };
|
buildEnv = callPackage ../../wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; };
|
||||||
withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;};
|
withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;};
|
||||||
|
@ -42,6 +42,8 @@ let
|
|||||||
nativeBuildInputs =
|
nativeBuildInputs =
|
||||||
optional (stdenv.hostPlatform != stdenv.buildPlatform) buildPackages.python3;
|
optional (stdenv.hostPlatform != stdenv.buildPlatform) buildPackages.python3;
|
||||||
|
|
||||||
|
hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false);
|
||||||
|
|
||||||
in stdenv.mkDerivation {
|
in stdenv.mkDerivation {
|
||||||
name = "python3-${version}";
|
name = "python3-${version}";
|
||||||
pythonVersion = majorVersion;
|
pythonVersion = majorVersion;
|
||||||
@ -77,6 +79,16 @@ in stdenv.mkDerivation {
|
|||||||
})
|
})
|
||||||
] ++ optionals (x11Support && stdenv.isDarwin) [
|
] ++ optionals (x11Support && stdenv.isDarwin) [
|
||||||
./use-correct-tcl-tk-on-darwin.patch
|
./use-correct-tcl-tk-on-darwin.patch
|
||||||
|
] ++ optionals hasDistutilsCxxPatch [
|
||||||
|
# Fix for http://bugs.python.org/issue1222585
|
||||||
|
# Upstream distutils is calling C compiler to compile C++ code, which
|
||||||
|
# only works for GCC and Apple Clang. This makes distutils to call C++
|
||||||
|
# compiler when needed.
|
||||||
|
(fetchpatch {
|
||||||
|
url = "https://bugs.python.org/file47046/python-3.x-distutils-C++.patch";
|
||||||
|
sha256 = "0dgdn9k2kmw4wh90vdnjcrnn97ylxgx7mbn9l87fwz6j501jqvk8";
|
||||||
|
extraPrefix = "";
|
||||||
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
@ -189,7 +201,7 @@ in stdenv.mkDerivation {
|
|||||||
passthru = let
|
passthru = let
|
||||||
pythonPackages = callPackage ../../../../../top-level/python-packages.nix {python=self; overrides=packageOverrides;};
|
pythonPackages = callPackage ../../../../../top-level/python-packages.nix {python=self; overrides=packageOverrides;};
|
||||||
in rec {
|
in rec {
|
||||||
inherit libPrefix sitePackages x11Support;
|
inherit libPrefix sitePackages x11Support hasDistutilsCxxPatch;
|
||||||
executable = "${libPrefix}m";
|
executable = "${libPrefix}m";
|
||||||
buildEnv = callPackage ../../wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; };
|
buildEnv = callPackage ../../wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; };
|
||||||
withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;};
|
withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;};
|
||||||
|
@ -14,8 +14,9 @@ buildPythonPackage rec {
|
|||||||
buildInputs = [ gfortran nose blas ];
|
buildInputs = [ gfortran nose blas ];
|
||||||
|
|
||||||
patches = lib.optionals (python.hasDistutilsCxxPatch or false) [
|
patches = lib.optionals (python.hasDistutilsCxxPatch or false) [
|
||||||
# See cpython 2.7 patches.
|
# We patch cpython/distutils to fix https://bugs.python.org/issue1222585
|
||||||
# numpy.distutils is used by cython during it's check phase
|
# Patching of numpy.distutils is needed to prevent it from undoing the
|
||||||
|
# patch to distutils.
|
||||||
./numpy-distutils-C++.patch
|
./numpy-distutils-C++.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user