Skip to content

Commit 7fdefac

Browse files
committed
bpo-32726: Build macOS 10.9+ installer with private copy of Tcl/Tk 8.6
1 parent 1e17d4a commit 7fdefac

File tree

5 files changed

+84
-75
lines changed

5 files changed

+84
-75
lines changed

‎Mac/BuildScript/build-installer.py‎

Lines changed: 67 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ def getTargetCompilers():
189189
# '/Library/Frameworks/Tk.framework/Versions/8.5/Tk']
190190
EXPECTED_SHARED_LIBS = {}
191191

192+
# Are we building and linking with our own copy of Tcl/TK?
193+
# For now, do so if deployment target is 10.9+.
194+
def internalTk():
195+
return getDeptargetTuple() >= (10, 9)
196+
192197
# List of names of third party software built with this installer.
193198
# The names will be inserted into the rtf version of the License.
194199
THIRD_PARTY_LIBS = []
@@ -217,13 +222,12 @@ def library_recipes():
217222
),
218223
])
219224

220-
# Disable for now
221-
if False: # if getDeptargetTuple() > (10, 5):
225+
if internalTk():
222226
result.extend([
223227
dict(
224-
name="Tcl 8.5.15",
225-
url="ftp://ftp.tcl.tk/pub/tcl//tcl8_5/tcl8.5.15-src.tar.gz",
226-
checksum='f3df162f92c69b254079c4d0af7a690f',
228+
name="Tcl 8.6.7",
229+
url="ftp://ftp.tcl.tk/pub/tcl//tcl8_6/tcl8.6.7-src.tar.gz",
230+
checksum='5673aaf45b5de5d8dd80bb3daaeb8838',
227231
buildDir="unix",
228232
configure_pre=[
229233
'--enable-shared',
@@ -233,16 +237,13 @@ def library_recipes():
233237
useLDFlags=False,
234238
install='make TCL_LIBRARY=%(TCL_LIBRARY)s && make install TCL_LIBRARY=%(TCL_LIBRARY)s DESTDIR=%(DESTDIR)s'%{
235239
"DESTDIR": shellQuote(os.path.join(WORKDIR, 'libraries')),
236-
"TCL_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tcl8.5'%(getVersion())),
240+
"TCL_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tcl8.6'%(getVersion())),
237241
},
238242
),
239243
dict(
240-
name="Tk 8.5.15",
241-
url="ftp://ftp.tcl.tk/pub/tcl//tcl8_5/tk8.5.15-src.tar.gz",
242-
checksum='55b8e33f903210a4e1c8bce0f820657f',
243-
patches=[
244-
"issue19373_tk_8_5_15_source.patch",
245-
],
244+
name="Tk 8.6.7",
245+
url="ftp://ftp.tcl.tk/pub/tcl//tcl8_6/tk8.6.7-src.tar.gz",
246+
checksum='46ea9c0165c515d87393700f4891ab6f',
246247
buildDir="unix",
247248
configure_pre=[
248249
'--enable-aqua',
@@ -253,8 +254,8 @@ def library_recipes():
253254
useLDFlags=False,
254255
install='make TCL_LIBRARY=%(TCL_LIBRARY)s TK_LIBRARY=%(TK_LIBRARY)s && make install TCL_LIBRARY=%(TCL_LIBRARY)s TK_LIBRARY=%(TK_LIBRARY)s DESTDIR=%(DESTDIR)s'%{
255256
"DESTDIR": shellQuote(os.path.join(WORKDIR, 'libraries')),
256-
"TCL_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tcl8.5'%(getVersion())),
257-
"TK_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tk8.5'%(getVersion())),
257+
"TCL_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tcl8.6'%(getVersion())),
258+
"TK_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tk8.6'%(getVersion())),
258259
},
259260
),
260261
])
@@ -547,42 +548,45 @@ def checkEnvironment():
547548
fatal("This script should be run on a macOS 10.5 (or later) system")
548549

549550
# Because we only support dynamic load of only one major/minor version of
551+
# Tcl/Tk, if we are not using building and using our own private copy of
550552
# Tcl/Tk, ensure:
551553
# 1. there is a user-installed framework (usually ActiveTcl) in (or linked
552554
# in) SDKROOT/Library/Frameworks. As of Python 3.7.0, we no longer
553555
# enforce that the version of the user-installed framework also
554556
# exists in the system-supplied Tcl/Tk frameworks. Time to support
555557
# Tcl/Tk 8.6 even if Apple does not.
556-
557-
frameworks = {}
558-
for framework in ['Tcl', 'Tk']:
559-
fwpth = 'Library/Frameworks/%s.framework/Versions/Current' % framework
560-
libfw = os.path.join('/', fwpth)
561-
usrfw = os.path.join(os.getenv('HOME'), fwpth)
562-
frameworks[framework] = os.readlink(libfw)
563-
if not os.path.exists(libfw):
564-
fatal("Please install a link to a current %s %s as %s so "
565-
"the user can override the system framework."
566-
% (framework, frameworks[framework], libfw))
567-
if os.path.exists(usrfw):
568-
fatal("Please rename %s to avoid possible dynamic load issues."
569-
% usrfw)
570-
571-
if frameworks['Tcl'] != frameworks['Tk']:
572-
fatal("The Tcl and Tk frameworks are not the same version.")
573-
574-
print(" -- Building with Tcl/Tk %s frameworks"
575-
% frameworks['Tk'])
558+
if not internalTk():
559+
frameworks = {}
560+
for framework in ['Tcl', 'Tk']:
561+
fwpth = 'Library/Frameworks/%s.framework/Versions/Current' % framework
562+
libfw = os.path.join('/', fwpth)
563+
usrfw = os.path.join(os.getenv('HOME'), fwpth)
564+
frameworks[framework] = os.readlink(libfw)
565+
if not os.path.exists(libfw):
566+
fatal("Please install a link to a current %s %s as %s so "
567+
"the user can override the system framework."
568+
% (framework, frameworks[framework], libfw))
569+
if os.path.exists(usrfw):
570+
fatal("Please rename %s to avoid possible dynamic load issues."
571+
% usrfw)
572+
573+
if frameworks['Tcl'] != frameworks['Tk']:
574+
fatal("The Tcl and Tk frameworks are not the same version.")
575+
576+
print(" -- Building with external Tcl/Tk %s frameworks"
577+
% frameworks['Tk'])
578+
579+
# add files to check after build
580+
EXPECTED_SHARED_LIBS['_tkinter.so'] = [
581+
"/Library/Frameworks/Tcl.framework/Versions/%s/Tcl"
582+
% frameworks['Tcl'],
583+
"/Library/Frameworks/Tk.framework/Versions/%s/Tk"
584+
% frameworks['Tk'],
585+
]
586+
else:
587+
print(" -- Building private copy of Tcl/Tk")
576588
print("")
577589

578-
# add files to check after build
579-
EXPECTED_SHARED_LIBS['_tkinter.so'] = [
580-
"/Library/Frameworks/Tcl.framework/Versions/%s/Tcl"
581-
% frameworks['Tcl'],
582-
"/Library/Frameworks/Tk.framework/Versions/%s/Tk"
583-
% frameworks['Tk'],
584-
]
585-
586590
# Remove inherited environment variables which might influence build
587591
environ_var_prefixes = ['CPATH', 'C_INCLUDE_', 'DYLD_', 'LANG', 'LC_',
588592
'LD_', 'LIBRARY_', 'PATH', 'PYTHON']
@@ -1086,12 +1090,18 @@ def buildPython():
10861090
"--with-universal-archs=%s "
10871091
"%s "
10881092
"%s "
1093+
"%s "
1094+
"%s "
10891095
"LDFLAGS='-g -L%s/libraries/usr/local/lib' "
10901096
"CFLAGS='-g -I%s/libraries/usr/local/include' 2>&1"%(
10911097
shellQuote(os.path.join(SRCDIR, 'configure')),
10921098
UNIVERSALARCHS,
10931099
(' ', '--with-computed-gotos ')[PYTHON_3],
10941100
(' ', '--without-ensurepip ')[PYTHON_3],
1101+
(' ', "--with-tcltk-includes='-I%s/libraries/usr/local/include'"%(
1102+
shellQuote(WORKDIR)[1:-1],))[internalTk()],
1103+
(' ', "--with-tcltk-libs='-L%s/libraries/usr/local/lib -ltcl8.6 -ltk8.6'"%(
1104+
shellQuote(WORKDIR)[1:-1],))[internalTk()],
10951105
shellQuote(WORKDIR)[1:-1],
10961106
shellQuote(WORKDIR)[1:-1]))
10971107

@@ -1126,14 +1136,22 @@ def buildPython():
11261136
del os.environ['DYLD_LIBRARY_PATH']
11271137
print("Copying required shared libraries")
11281138
if os.path.exists(os.path.join(WORKDIR, 'libraries', 'Library')):
1129-
runCommand("mv %s/* %s"%(
1130-
shellQuote(os.path.join(
1139+
build_lib_dir = os.path.join(
11311140
WORKDIR, 'libraries', 'Library', 'Frameworks',
1132-
'Python.framework', 'Versions', getVersion(),
1133-
'lib')),
1134-
shellQuote(os.path.join(WORKDIR, '_root', 'Library', 'Frameworks',
1135-
'Python.framework', 'Versions', getVersion(),
1136-
'lib'))))
1141+
'Python.framework', 'Versions', getVersion(), 'lib')
1142+
fw_lib_dir = os.path.join(
1143+
WORKDIR, '_root', 'Library', 'Frameworks',
1144+
'Python.framework', 'Versions', getVersion(), 'lib')
1145+
if internalTk():
1146+
# move Tcl and Tk pkgconfig files
1147+
runCommand("mv %s/pkgconfig/* %s/pkgconfig"%(
1148+
shellQuote(build_lib_dir),
1149+
shellQuote(fw_lib_dir) ))
1150+
runCommand("rm -r %s/pkgconfig"%(
1151+
shellQuote(build_lib_dir), ))
1152+
runCommand("mv %s/* %s"%(
1153+
shellQuote(build_lib_dir),
1154+
shellQuote(fw_lib_dir) ))
11371155

11381156
frmDir = os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework')
11391157
frmDirVersioned = os.path.join(frmDir, 'Versions', version)

‎Mac/BuildScript/issue19373_tk_8_5_15_source.patch‎

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎Mac/BuildScript/resources/ReadMe.rtf‎

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,20 @@ For Python.3.7, python.org currently provides two installer variants for downloa
3131
\i0 variant. Use the 10.6 variant if you are running on macOS 10.6 through 10.8 or if you want to produce standalone applications that can run on systems from 10.6. If you are running on macOS 10.9 or later and if you have no need for compatibility with older systems, use the 10.9 variant. The Pythons installed by these installers are built with private copies of some third-party libraries not included with or newer than those in macOS itself. The list of these libraries varies by installer variant and is included at the end of the License.rtf file.
3232
\b \ul \
3333
\
34+
Using IDLE or other Tk applications [NEW/CHANGED in 3.7.0b1]
35+
\b0 \ulnone \
36+
\
37+
The 10.9+ installer variant comes with its own private version of Tcl/Tk 8.6. It does not use system-supplied or third-party supplied versions of Tcl/Tk.\
38+
\
39+
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
40+
\cf0 For the 10.6+ variant, you continue to need to install a newer third-party version of the
41+
\i Tcl/Tk
42+
\i0 8.5 (not 8.6) frameworks to use IDLE or other programs that use the Tkinter graphical user interface toolkit. Visit {\field{\*\fldinst{HYPERLINK "https://www.python.org/download/mac/tcltk/"}}{\fldrslt https://www.python.org/download/mac/tcltk/}} for current information about supported and recommended versions of
43+
\i Tcl/Tk
44+
\i0 for this version of Python and of macOS.\
45+
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
46+
47+
\b \cf0 \ul \ulc0 \
3448
Certificate verification and OpenSSL \{UPDATED in 3.7.0b1]\
3549
3650
\b0 \ulnone \
@@ -53,17 +67,7 @@ The bundled
5367
\f0 included with this installer has its own default certificate store for verifying download connections.\
5468
\
5569

56-
\b \ul Update your version of Tcl/Tk to use IDLE or other Tk applications [CHANGED in 3.7.0b1]
57-
\b0 \ulnone \
58-
\
59-
To use IDLE or other programs that use the Tkinter graphical user interface toolkit, you need to install a newer third-party version of the
60-
\i Tcl/Tk
61-
\i0 frameworks. Visit {\field{\*\fldinst{HYPERLINK "https://www.python.org/download/mac/tcltk/"}}{\fldrslt https://www.python.org/download/mac/tcltk/}} for current information about supported and recommended versions of
62-
\i Tcl/Tk
63-
\i0 for this version of Python and of Mac OS X. For 3.7.0b1, the 10.9 installer variant is linked with Tcl/Tk 8.6 which you must install separately. The 10.6 installer links /with Tcl/Tk 8.5 which you should also download and install.\
64-
65-
\b \ul \
66-
Other changes\
70+
\b \ul Other changes\
6771
6872
\b0 \ulnone \
6973
For other changes in this release, see the

‎Mac/BuildScript/resources/Welcome.rtf‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
\
2424

2525
\b NEW in 3.7.0b1:
26-
\b0 two installer variants (10.9+ 64-bit-only, 10.6+ 64-/32-bit), Tcl/Tk 8.6 support in the 10.9+ variant, OpenSSL 1.1.0g, and more!\
26+
\b0 two installer variants (10.9+ 64-bit-only, 10.6+ 64-/32-bit), built-in Tcl/Tk 8.6 support in the 10.9+ variant (no additional third-party downloads!), OpenSSL 1.1.0g, and more!\
2727
\
2828

2929
\b IMPORTANT:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Provide an additional, more modern macOS installer variant that supports
22
macOS 10.9+ systems in 64-bit mode only. Upgrade the supplied third-party
33
libraries to OpenSSL 1.1.0g and to SQLite 3.22.0. The 10.9+ installer now
4-
links with Tcl/Tk 8.6.
4+
links with and supplies its own copy of Tcl/Tk 8.6.

0 commit comments

Comments
 (0)