Skip to content

bpo-39162 fix a logic bug in the Tcl/Tk include scanner for macOS in setup.py #17753

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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed an issue where the macOS SDK path wouldn't be discovered by setup.py, meaning _tkinter failed to build on macOS 10.15.
14 changes: 6 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1769,16 +1769,15 @@ def detect_tkinter_darwin(self):
for F in framework_dirs:
# both Tcl.framework and Tk.framework should be present


for fw in 'Tcl', 'Tk':
if is_macosx_sdk_path(F):
if not exists(join(sysroot, F[1:], fw + '.framework')):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, this condition would match, because in macOS 10.15 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Tk.framework exists, however, F is not the path that it's checking, so it adds /System/Library/Frameworks/Tk.framework to the list of include_dirs

break
framework_path = join(sysroot, F[1:])
else:
if not exists(join(F, fw + '.framework')):
break
framework_path = F
if not exists(join(framework_path, fw + '.framework')):
break
else:
# ok, F is now directory with both frameworks. Continure
# ok, framework_path is now directory with both frameworks. Continue
# building
break
else:
Expand All @@ -1791,11 +1790,10 @@ def detect_tkinter_darwin(self):
# the -F option to gcc, which specifies a framework lookup path.
#
include_dirs = [
join(F, fw + '.framework', H)
join(framework_path, fw + '.framework', H)
for fw in ('Tcl', 'Tk')
for H in ('Headers', 'Versions/Current/PrivateHeaders')
]

# For 8.4a2, the X11 headers are not included. Rather than include a
# complicated search, this is a hard-coded path. It could bail out
# if X11 libs are not found...
Expand Down