diff --git a/pkgs/development/interpreters/python/cpython/3.9/darwin-tcl-tk.patch b/pkgs/development/interpreters/python/cpython/3.9/darwin-tcl-tk.patch new file mode 100644 index 000000000000..a9b0c0677c5e --- /dev/null +++ b/pkgs/development/interpreters/python/cpython/3.9/darwin-tcl-tk.patch @@ -0,0 +1,15 @@ +diff --git a/setup.py b/setup.py +index 04eb6b2..2e1160d 100644 +--- a/setup.py ++++ b/setup.py +@@ -1981,8 +1981,8 @@ class PyBuildExt(build_ext): + # Rather than complicate the code below, detecting and building + # AquaTk is a separate method. Only one Tkinter will be built on + # Darwin - either AquaTk, if it is found, or X11 based Tk. +- if (MACOS and self.detect_tkinter_darwin()): +- return True ++ # if (MACOS and self.detect_tkinter_darwin()): ++ # return True + + # Assume we haven't found any of the libraries or include files + # The versions with dots are used on Unix, and the versions without diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index d59d3cb44708..76a66a648d84 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -235,6 +235,9 @@ in with passthru; stdenv.mkDerivation { else ./3.5/profile-task.patch ) + ] ++ optionals (pythonAtLeast "3.9" && stdenv.isDarwin) [ + # Stop checking for TCL/TK in global macOS locations + ./3.9/darwin-tcl-tk.patch ] ++ optionals (isPy3k && hasDistutilsCxxPatch) [ # Fix for http://bugs.python.org/issue1222585 # Upstream distutils is calling C compiler to compile C++ code, which @@ -335,6 +338,8 @@ in with passthru; stdenv.mkDerivation { '' + optionalString stdenv.isDarwin '' export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -msse2" export MACOSX_DEPLOYMENT_TARGET=10.6 + # Override the auto-detection in setup.py, which assumes a universal build + export PYTHON_DECIMAL_WITH_MACHINE=${if stdenv.isAarch64 then "uint128" else "x64"} '' + optionalString (isPy3k && pythonOlder "3.7") '' # Determinism: The interpreter is patched to write null timestamps when compiling Python files # so Python doesn't try to update the bytecode when seeing frozen timestamps in Nix's store.