@@ -33,6 +33,7 @@ class PythonAT38 < Formula
33
33
depends_on "openssl@1.1"
34
34
depends_on "readline"
35
35
depends_on "sqlite"
36
+ depends_on "tcl-tk"
36
37
depends_on "xz"
37
38
38
39
uses_from_macos "bzip2"
@@ -97,14 +98,13 @@ def install
97
98
# The setup.py looks at "-isysroot" to get the sysroot (and not at --sysroot)
98
99
cflags << "-isysroot #{ MacOS . sdk_path } " << "-I#{ MacOS . sdk_path } /usr/include"
99
100
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"
104
101
end
105
102
# Avoid linking to libgcc https://mail.python.org/pipermail/python-dev/2012-February/116205.html
106
103
args << "MACOSX_DEPLOYMENT_TARGET=#{ MacOS . version . to_f } "
107
104
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
+
108
108
# We want our readline! This is just to outsmart the detection code,
109
109
# superenv makes cc always find includes/libs!
110
110
inreplace "setup.py" ,
@@ -239,9 +239,9 @@ def post_install
239
239
240
240
# Help distutils find brewed stuff when building extensions
241
241
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
243
243
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
245
245
246
246
cfg = prefix /"Frameworks/Python.framework/Versions/#{ xy } /lib/python#{ xy } /distutils/distutils.cfg"
247
247
@@ -318,9 +318,7 @@ def caveats
318
318
system "#{ bin } /python#{ xy } " , "-c" , "import sqlite3"
319
319
# Check if some other modules import. Then the linked libs are working.
320
320
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()"
324
322
325
323
system "#{ bin } /python#{ xy } " , "-c" , "import _gdbm"
326
324
system "#{ bin } /python#{ xy } " , "-c" , "import zlib"
0 commit comments