Skip to content

Commit 5b3582c

Browse files
committed
Issue #15663: Tcl/Tk 8.5.15 is now included with the OS X 10.6+
64-bit/32-bit installer for 10.6+. It is no longer necessary to install a third-party version of Tcl/Tk 8.5 to work around the problems in the Apple-supplied Tcl/Tk 8.5 shipped in OS X 10.6 and later releases.
1 parent 65657c2 commit 5b3582c

File tree

5 files changed

+150
-27
lines changed

5 files changed

+150
-27
lines changed

Mac/BuildScript/README.txt

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,40 @@ for each release.
5757

5858
* NCurses 5.9 (http://bugs.python.org/issue15037)
5959
* SQLite 3.7.13
60+
* Tcl 8.5.15
61+
* Tk 8.5.15
6062
* XZ 5.0.3
6163

6264
- uses system-supplied versions of third-party libraries
6365

6466
* readline module links with Apple BSD editline (libedit)
6567

66-
- requires ActiveState Tcl/Tk 8.5.9 (or later) to be installed for building
68+
- requires ActiveState Tcl/Tk 8.5.14 (or later) to be installed for building
69+
70+
* Beginning with Python 3.3.3, this installer now includes its own
71+
private copy of Tcl and Tk 8.5.15 libraries and thus is no longer
72+
dependent on the buggy releases of Aqua Cocoa Tk 8.5 shipped with
73+
OS X 10.6 or on installing a newer third-party version of Tcl/Tk
74+
in /Library/Frameworks, such as from ActiveState. If it is
75+
necessary to fallback to using a third-party Tcl/Tk because of
76+
a problem with the private Tcl/Tk, there is a backup version of
77+
the _tkinter extension included which will dynamically link to
78+
Tcl and Tk frameworks in /Library/Frameworks as in previous releases.
79+
To enable (for all users of this Python 3.3)::
80+
81+
sudo bash
82+
cd /Library/Frameworks/Python.framework/Versions/3.3
83+
cd ./lib/python3.3/lib-dynload
84+
cp -p _tkinter.so.framework _tkinter.so
85+
exit
86+
87+
To restore using Python's private versions of Tcl and Tk::
88+
89+
sudo bash
90+
cd /Library/Frameworks/Python.framework/Versions/3.3
91+
cd ./lib/python3.3/lib-dynload
92+
cp -p _tkinter.so.private _tkinter.so
93+
exit
6794

6895
- recommended build environment:
6996

@@ -82,7 +109,7 @@ for each release.
82109
considered a migration aid by Apple and is not likely to be fixed,
83110
its use should be avoided. The other compiler, ``clang``, has been
84111
undergoing rapid development. While it appears to have become
85-
production-ready in the most recent Xcode 4 releases (Xcode 4.4.1
112+
production-ready in the most recent Xcode 4 releases (Xcode 4.6.3
86113
as of this writing), there are still some open issues when
87114
building Python and there has not yet been the level of exposure in
88115
production environments that the Xcode 3 gcc-4.2 compiler has had.

Mac/BuildScript/build-installer.py

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,44 @@ def library_recipes():
193193

194194
LT_10_5 = bool(DEPTARGET < '10.5')
195195

196+
if DEPTARGET > '10.5':
197+
result.extend([
198+
dict(
199+
name="Tcl 8.5.15",
200+
url="ftp://ftp.tcl.tk/pub/tcl//tcl8_5/tcl8.5.15-src.tar.gz",
201+
checksum='f3df162f92c69b254079c4d0af7a690f',
202+
buildDir="unix",
203+
configure_pre=[
204+
'--enable-shared',
205+
'--enable-threads',
206+
'--libdir=/Library/Frameworks/Python.framework/Versions/%s/lib'%(getVersion(),),
207+
],
208+
useLDFlags=False,
209+
install='make TCL_LIBRARY=%(TCL_LIBRARY)s && make install TCL_LIBRARY=%(TCL_LIBRARY)s DESTDIR=%(DESTDIR)s'%{
210+
"DESTDIR": shellQuote(os.path.join(WORKDIR, 'libraries')),
211+
"TCL_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tcl8.5'%(getVersion())),
212+
},
213+
),
214+
dict(
215+
name="Tk 8.5.15",
216+
url="ftp://ftp.tcl.tk/pub/tcl//tcl8_5/tk8.5.15-src.tar.gz",
217+
checksum='55b8e33f903210a4e1c8bce0f820657f',
218+
buildDir="unix",
219+
configure_pre=[
220+
'--enable-aqua',
221+
'--enable-shared',
222+
'--enable-threads',
223+
'--libdir=/Library/Frameworks/Python.framework/Versions/%s/lib'%(getVersion(),),
224+
],
225+
useLDFlags=False,
226+
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'%{
227+
"DESTDIR": shellQuote(os.path.join(WORKDIR, 'libraries')),
228+
"TCL_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tcl8.5'%(getVersion())),
229+
"TK_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tk8.5'%(getVersion())),
230+
},
231+
),
232+
])
233+
196234
if getVersionTuple() >= (3, 3):
197235
result.extend([
198236
dict(
@@ -526,6 +564,20 @@ def checkEnvironment():
526564
% frameworks['Tk'],
527565
]
528566

567+
# For 10.6+ builds, we build two versions of _tkinter:
568+
# - the traditional version (renamed to _tkinter.so.framework) linked
569+
# with /Library/Frameworks/{Tcl,Tk}.framework
570+
# - the default version linked with our private copies of Tcl and Tk
571+
if DEPTARGET > '10.5':
572+
EXPECTED_SHARED_LIBS['_tkinter.so.framework'] = \
573+
EXPECTED_SHARED_LIBS['_tkinter.so']
574+
EXPECTED_SHARED_LIBS['_tkinter.so'] = [
575+
"/Library/Frameworks/Python.framework/Versions/%s/lib/libtcl%s.dylib"
576+
% (getVersion(), frameworks['Tcl']),
577+
"/Library/Frameworks/Python.framework/Versions/%s/lib/libtk%s.dylib"
578+
% (getVersion(), frameworks['Tk']),
579+
]
580+
529581
# Remove inherited environment variables which might influence build
530582
environ_var_prefixes = ['CPATH', 'C_INCLUDE_', 'DYLD_', 'LANG', 'LC_',
531583
'LD_', 'LIBRARY_', 'PATH', 'PYTHON']
@@ -634,13 +686,19 @@ def extractArchive(builddir, archiveName):
634686
635687
XXX: This function assumes that archives contain a toplevel directory
636688
that is has the same name as the basename of the archive. This is
637-
save enough for anything we use.
689+
safe enough for almost anything we use. Unfortunately, it does not
690+
work for current Tcl and Tk source releases where the basename of
691+
the archive ends with "-src" but the uncompressed directory does not.
692+
For now, just special case Tcl and Tk tar.gz downloads.
638693
"""
639694
curdir = os.getcwd()
640695
try:
641696
os.chdir(builddir)
642697
if archiveName.endswith('.tar.gz'):
643698
retval = os.path.basename(archiveName[:-7])
699+
if ((retval.startswith('tcl') or retval.startswith('tk'))
700+
and retval.endswith('-src')):
701+
retval = retval[:-4]
644702
if os.path.exists(retval):
645703
shutil.rmtree(retval)
646704
fp = os.popen("tar zxf %s 2>&1"%(shellQuote(archiveName),), 'r')
@@ -904,6 +962,23 @@ def buildPython():
904962
print("Running make")
905963
runCommand("make")
906964

965+
# For deployment targets of 10.6 and higher, we build our own version
966+
# of Tcl and Cocoa Aqua Tk libs because the Apple-supplied Tk 8.5 is
967+
# out-of-date and has critical bugs. Save the _tkinter.so that was
968+
# linked with /Library/Frameworks/{Tck,Tk}.framework and build
969+
# another _tkinter.so linked with our private Tcl and Tk libs.
970+
if DEPTARGET > '10.5':
971+
runCommand("find build -name '_tkinter.so' "
972+
" -execdir mv '{}' '{}'.framework \;")
973+
print("Running make to rebuild _tkinter")
974+
runCommand("make TCLTK_INCLUDES='-I%s/libraries/usr/local/include' "
975+
"TCLTK_LIBS='-L%s/libraries/usr/local/lib -ltcl8.5 -ltk8.5'"%(
976+
shellQuote(WORKDIR)[1:-1],
977+
shellQuote(WORKDIR)[1:-1]))
978+
# make a backup copy, just in case
979+
runCommand("find build -name '_tkinter.so' "
980+
" -execdir cp -p '{}' '{}'.private \;")
981+
907982
print("Running make install")
908983
runCommand("make install DESTDIR=%s"%(
909984
shellQuote(rootDir)))

Mac/BuildScript/resources/ReadMe.txt

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ This package will install Python $FULL_VERSION for Mac OS X
22
$MACOSX_DEPLOYMENT_TARGET for the following architecture(s):
33
$ARCHITECTURES.
44

5-
Installation requires approximately $INSTALL_SIZE MB of disk space,
6-
ignore the message that it will take zero bytes.
5+
**** IMPORTANT ****
6+
7+
Installing on OS X 10.8 (Mountain Lion) or later systems
8+
========================================================
79

8-
If you are attempting to install on an OS X 10.8 system, you may
10+
If you are attempting to install on an OS X 10.8+ system, you may
911
see a message that Python can't be installed because it is from an
1012
unidentified developer. This is because this Python installer
1113
package is not yet compatible with the Gatekeeper security feature
@@ -15,22 +17,36 @@ instead of double-clicking, control-click or right click the "Python"
1517
installer package icon. Then select "Open using ... Installer" from
1618
the contextual menu that appears.
1719

20+
**** IMPORTANT changes if you use IDLE and Tkinter ****
21+
22+
Installing a third-party version of Tcl/Tk is no longer required
23+
================================================================
24+
25+
As of Python 3.3.3, the 10.6+ 64-bit installer now
26+
comes with its own private copy of Tcl and Tk 8.5 libraries. For
27+
this version of Python, it is no longer necessary to install
28+
a third-party version of Tcl/Tk 8.5, such as those from ActiveState,
29+
to work around the problematic versions of Tcl/Tk 8.5 shipped by
30+
Apple in OS X 10.6 and later. (This does not change the requirements
31+
for older versions of Python installed from python.org.) By default,
32+
this version of Python will always use its own private version,
33+
regardless of whether a third-party Tcl/Tk is installed.
34+
The 10.5+ 32-bit-only installer continues to use Tcl/Tk 8.4,
35+
either a third-party or system-supplied version.
36+
37+
Visit http://www.python.org/download/mac/tcltk/
38+
for current information about supported and recommended versions of
39+
Tcl/Tk for this version of Python and of Mac OS X.
40+
41+
Using this version of Python on OS X
42+
====================================
43+
1844
Python consists of the Python programming language interpreter, plus
1945
a set of programs to allow easy access to it for Mac users including
2046
an integrated development environment, IDLE, plus a set of pre-built
2147
extension modules that open up specific Macintosh technologies to
2248
Python programs.
2349

24-
**** IMPORTANT ****
25-
26-
To use IDLE or other programs that use the tkinter graphical user
27-
interface toolkit, you may need to install a third-party version of
28-
the Tcl/Tk frameworks. Visit http://www.python.org/download/mac/tcltk/
29-
for current information about supported and recommended versions of
30-
Tcl/Tk for this version of Python and of Mac OS X.
31-
32-
*******************
33-
3450
The installer puts applications, an "Update Shell Profile" command,
3551
and a link to the optionally installed Python Documentation into the
3652
"Python $VERSION" subfolder of the system Applications folder,
@@ -41,12 +57,15 @@ well. Double-click on the "Update Shell Profile" command to add the
4157
"bin" directory inside the framework to your shell's search path.
4258

4359
You must install onto your current boot disk, even though the
44-
installer does not enforce this, otherwise things will not work.
60+
installer may not enforce this, otherwise things will not work.
4561

4662
You can verify the integrity of the disk image file containing the
4763
installer package and this ReadMe file by comparing its md5 checksum
4864
and size with the values published on the release page linked at
4965
http://www.python.org/download/
5066

67+
Installation requires approximately $INSTALL_SIZE MB of disk space,
68+
ignore the message that it will take zero bytes.
69+
5170
More information on Python in general can be found at
5271
http://www.python.org.

Mac/BuildScript/resources/Welcome.rtf

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf470
2-
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
1+
{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
2+
\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
33
{\colortbl;\red255\green255\blue255;}
4-
\paperw11904\paperh16836\margl1440\margr1440\vieww9640\viewh10620\viewkind0
4+
\paperw11905\paperh16837\margl1440\margr1440\vieww9640\viewh10620\viewkind0
55
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640
66

77
\f0\fs24 \cf0 This package will install
@@ -25,11 +25,7 @@ See the ReadMe file and the Python documentation for more information.\
2525
\b0 at any time to make $FULL_VERSION the default Python 3 version. This version can co-exist with other installed versions of Python 3 and Python 2.\
2626
\
2727

28-
\b IMPORTANT:
29-
\b0
30-
\b IDLE
31-
\b0 and other programs using the
32-
\b tkinter
33-
\b0 graphical user interface toolkit require specific versions of the
28+
\b IMPORTANT for users of IDLE and tkinter:
29+
\b0 As of Python 3.3.3, it is no longer necessary to install third-party versions of the
3430
\b Tcl/Tk
35-
\b0 platform independent windowing toolkit. Visit {\field{\*\fldinst{HYPERLINK "http://www.python.org/download/mac/tcltk/"}}{\fldrslt http://www.python.org/download/mac/tcltk/}} for current information on supported and recommended versions of Tcl/Tk for this version of Python and Mac OS X.}
31+
\b0 platform independent windowing toolkit. Please read the ReadMe file and visit {\field{\*\fldinst{HYPERLINK "http://www.python.org/download/mac/tcltk/"}}{\fldrslt http://www.python.org/download/mac/tcltk/}} for more information on supported and recommended versions of Tcl/Tk for this version of Python and Mac OS X.}

Misc/NEWS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,12 @@ Build
595595
- Issue #1584: Provide options to override default search paths for
596596
Tcl and Tk when building _tkinter.
597597

598+
- Issue #15663: Tcl/Tk 8.5.15 is now included with the OS X 10.6+
599+
64-bit/32-bit installer for 10.6+. It is no longer necessary
600+
to install a third-party version of Tcl/Tk 8.5 to work around the
601+
problems in the Apple-supplied Tcl/Tk 8.5 shipped in OS X 10.6
602+
and later releases.
603+
598604

599605
What's New in Python 3.3.2?
600606
===========================

0 commit comments

Comments
 (0)