Skip to content

Commit 94b985a

Browse files
committed
python@3.8: use our own tcl-tk
via Homebrew/homebrew-core@4dc505d
1 parent 8c7b604 commit 94b985a

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

Formula/python@3.8.rb

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class PythonAT38 < Formula
3333
depends_on "openssl@1.1"
3434
depends_on "readline"
3535
depends_on "sqlite"
36+
depends_on "tcl-tk"
3637
depends_on "xz"
3738

3839
uses_from_macos "bzip2"
@@ -97,14 +98,13 @@ def install
9798
# The setup.py looks at "-isysroot" to get the sysroot (and not at --sysroot)
9899
cflags << "-isysroot #{MacOS.sdk_path}" << "-I#{MacOS.sdk_path}/usr/include"
99100
ldflags << "-isysroot #{MacOS.sdk_path}"
100-
# For the Xlib.h, Python needs this header dir with the system Tk
101-
# Yep, this needs the absolute path where zlib needed a path relative
102-
# to the SDK.
103-
cflags << "-I#{MacOS.sdk_path}/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers"
104101
end
105102
# Avoid linking to libgcc https://mail.python.org/pipermail/python-dev/2012-February/116205.html
106103
args << "MACOSX_DEPLOYMENT_TARGET=#{MacOS.version.to_f}"
107104

105+
args << "--with-tcltk-includes=-I#{Formula["tcl-tk"].opt_include}"
106+
args << "--with-tcltk-libs=-L#{Formula["tcl-tk"].opt_lib} -ltcl8.6 -ltk8.6"
107+
108108
# We want our readline! This is just to outsmart the detection code,
109109
# superenv makes cc always find includes/libs!
110110
inreplace "setup.py",
@@ -239,9 +239,9 @@ def post_install
239239

240240
# Help distutils find brewed stuff when building extensions
241241
include_dirs = [HOMEBREW_PREFIX/"include", Formula["openssl@1.1"].opt_include,
242-
Formula["sqlite"].opt_include]
242+
Formula["sqlite"].opt_include], Formula["tcl-tk"].opt_include
243243
library_dirs = [HOMEBREW_PREFIX/"lib", Formula["openssl@1.1"].opt_lib,
244-
Formula["sqlite"].opt_lib]
244+
Formula["sqlite"].opt_lib], Formula["tcl-tk"].opt_lib
245245

246246
cfg = prefix/"Frameworks/Python.framework/Versions/#{xy}/lib/python#{xy}/distutils/distutils.cfg"
247247

@@ -318,9 +318,7 @@ def caveats
318318
system "#{bin}/python#{xy}", "-c", "import sqlite3"
319319
# Check if some other modules import. Then the linked libs are working.
320320

321-
# Temporary failure on macOS 11.1 due to https://bugs.python.org/issue42480
322-
# Reenable unconditionnaly once Apple fixes the Tcl/Tk issue
323-
system "#{bin}/python#{xy}", "-c", "import tkinter; root = tkinter.Tk()" if MacOS.full_version < "11.1"
321+
system "#{bin}/python#{xy}", "-c", "import tkinter; root = tkinter.Tk()"
324322

325323
system "#{bin}/python#{xy}", "-c", "import _gdbm"
326324
system "#{bin}/python#{xy}", "-c", "import zlib"

0 commit comments

Comments
 (0)