Skip to content

Commit

Permalink
[email protected]: use our own tcl-tk
Browse files Browse the repository at this point in the history
Closes #70249.

Signed-off-by: Carlo Cabrera <[email protected]>
  • Loading branch information
Jamie Snape authored and carlocab committed Feb 3, 2021
1 parent 0a62b7f commit 4dc505d
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down Expand Up @@ -36,6 +36,7 @@ class PythonAT38 < Formula
depends_on "[email protected]"
depends_on "readline"
depends_on "sqlite"
depends_on "tcl-tk"
depends_on "xz"

uses_from_macos "bzip2"
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -259,9 +259,9 @@ def post_install

# Help distutils find brewed stuff when building extensions
include_dirs = [HOMEBREW_PREFIX/"include", Formula["[email protected]"].opt_include,
Formula["sqlite"].opt_include]
Formula["sqlite"].opt_include], Formula["tcl-tk"].opt_include
library_dirs = [HOMEBREW_PREFIX/"lib", Formula["[email protected]"].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"

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4dc505d

Please sign in to comment.