Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[email protected]: use our own tcl-tk #70249

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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