diff --git a/Formula/python@3.8.rb b/Formula/python@3.8.rb index b86be6060f04..c7d04a9453ff 100644 --- a/Formula/python@3.8.rb +++ b/Formula/python@3.8.rb @@ -4,7 +4,7 @@ class PythonAT38 < Formula url "https://www.python.org/ftp/python/3.8.7/Python-3.8.7.tar.xz" sha256 "ddcc1df16bb5b87aa42ec5d20a5b902f2d088caa269b28e01590f97a798ec50a" license "Python-2.0" - revision 1 + revision 2 livecheck do url "https://www.python.org/ftp/python/" @@ -36,6 +36,7 @@ class PythonAT38 < Formula depends_on "openssl@1.1" depends_on "readline" depends_on "sqlite" + depends_on "tcl-tk" depends_on "xz" uses_from_macos "bzip2" @@ -117,14 +118,13 @@ def install # The setup.py looks at "-isysroot" to get the sysroot (and not at --sysroot) cflags << "-isysroot #{MacOS.sdk_path}" ldflags << "-isysroot #{MacOS.sdk_path}" - # For the Xlib.h, Python needs this header dir with the system Tk - # Yep, this needs the absolute path where zlib needed a path relative - # to the SDK. - cflags << "-isystem #{MacOS.sdk_path}/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers" end # Avoid linking to libgcc https://mail.python.org/pipermail/python-dev/2012-February/116205.html args << "MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}" + args << "--with-tcltk-includes=-I#{Formula["tcl-tk"].opt_include}" + args << "--with-tcltk-libs=-L#{Formula["tcl-tk"].opt_lib} -ltcl8.6 -ltk8.6" + # We want our readline! This is just to outsmart the detection code, # superenv makes cc always find includes/libs! inreplace "setup.py", @@ -259,9 +259,9 @@ def post_install # Help distutils find brewed stuff when building extensions include_dirs = [HOMEBREW_PREFIX/"include", Formula["openssl@1.1"].opt_include, - Formula["sqlite"].opt_include] + Formula["sqlite"].opt_include], Formula["tcl-tk"].opt_include library_dirs = [HOMEBREW_PREFIX/"lib", Formula["openssl@1.1"].opt_lib, - Formula["sqlite"].opt_lib] + Formula["sqlite"].opt_lib], Formula["tcl-tk"].opt_lib cfg = prefix/"Frameworks/Python.framework/Versions/#{xy}/lib/python#{xy}/distutils/distutils.cfg" @@ -343,10 +343,7 @@ def caveats # Check if some other modules import. Then the linked libs are working. system "#{bin}/python#{xy}", "-c", "import _gdbm" system "#{bin}/python#{xy}", "-c", "import zlib" - - # Temporary failure on macOS 11.1 due to https://bugs.python.org/issue42480 - # Reenable unconditionnaly once Apple fixes the Tcl/Tk issue - system "#{bin}/python#{xy}", "-c", "import tkinter; root = tkinter.Tk()" if MacOS.full_version < "11.1" + system "#{bin}/python#{xy}", "-c", "import tkinter; root = tkinter.Tk()" system bin/"pip3", "list", "--format=columns" end