[Python-checkins] cpython (3.3): Issue #15663: Tcl/Tk 8.5.15 is now included with the OS X 10.6+

ned.deily python-checkins at python.org
Fri Oct 25 09:53:53 CEST 2013


http://hg.python.org/cpython/rev/5ff4f0100a40
changeset:   86616:5ff4f0100a40
branch:      3.3
user:        Ned Deily <nad at acm.org>
date:        Fri Oct 25 00:41:46 2013 -0700
summary:
  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.

files:
  Mac/BuildScript/README.txt            |  31 +++++-
  Mac/BuildScript/build-installer.py    |  77 ++++++++++++++-
  Mac/BuildScript/resources/ReadMe.txt  |  47 ++++++--
  Mac/BuildScript/resources/Welcome.rtf |  16 +-
  Misc/NEWS                             |   6 +
  5 files changed, 150 insertions(+), 27 deletions(-)


diff --git a/Mac/BuildScript/README.txt b/Mac/BuildScript/README.txt
--- a/Mac/BuildScript/README.txt
+++ b/Mac/BuildScript/README.txt
@@ -57,13 +57,40 @@
 
         * NCurses 5.9 (http://bugs.python.org/issue15037)
         * SQLite 3.7.13
+        * Tcl 8.5.15
+        * Tk 8.5.15
         * XZ 5.0.3
 
     - uses system-supplied versions of third-party libraries
 
         * readline module links with Apple BSD editline (libedit)
 
-    - requires ActiveState Tcl/Tk 8.5.9 (or later) to be installed for building
+    - requires ActiveState Tcl/Tk 8.5.14 (or later) to be installed for building
+
+        * Beginning with Python 3.3.3, this installer now includes its own
+          private copy of Tcl and Tk 8.5.15 libraries and thus is no longer
+          dependent on the buggy releases of Aqua Cocoa Tk 8.5 shipped with
+          OS X 10.6 or on installing a newer third-party version of Tcl/Tk
+          in /Library/Frameworks, such as from ActiveState.  If it is
+          necessary to fallback to using a third-party Tcl/Tk because of
+          a problem with the private Tcl/Tk, there is a backup version of
+          the _tkinter extension included which will dynamically link to
+          Tcl and Tk frameworks in /Library/Frameworks as in previous releases.
+          To enable (for all users of this Python 3.3)::
+
+              sudo bash
+              cd /Library/Frameworks/Python.framework/Versions/3.3
+              cd ./lib/python3.3/lib-dynload
+              cp -p _tkinter.so.framework _tkinter.so
+              exit
+
+          To restore using Python's private versions of Tcl and Tk::
+
+              sudo bash
+              cd /Library/Frameworks/Python.framework/Versions/3.3
+              cd ./lib/python3.3/lib-dynload
+              cp -p _tkinter.so.private _tkinter.so
+              exit
 
     - recommended build environment:
 
@@ -82,7 +109,7 @@
           considered a migration aid by Apple and is not likely to be fixed,
           its use should be avoided.  The other compiler, ``clang``, has been
           undergoing rapid development.  While it appears to have become
-          production-ready in the most recent Xcode 4 releases (Xcode 4.4.1
+          production-ready in the most recent Xcode 4 releases (Xcode 4.6.3
           as of this writing), there are still some open issues when
           building Python and there has not yet been the level of exposure in
           production environments that the Xcode 3 gcc-4.2 compiler has had.
diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py
--- a/Mac/BuildScript/build-installer.py
+++ b/Mac/BuildScript/build-installer.py
@@ -193,6 +193,44 @@
 
     LT_10_5 = bool(DEPTARGET < '10.5')
 
+    if DEPTARGET > '10.5':
+        result.extend([
+          dict(
+              name="Tcl 8.5.15",
+              url="ftp://ftp.tcl.tk/pub/tcl//tcl8_5/tcl8.5.15-src.tar.gz",
+              checksum='f3df162f92c69b254079c4d0af7a690f',
+              buildDir="unix",
+              configure_pre=[
+                    '--enable-shared',
+                    '--enable-threads',
+                    '--libdir=/Library/Frameworks/Python.framework/Versions/%s/lib'%(getVersion(),),
+              ],
+              useLDFlags=False,
+              install='make TCL_LIBRARY=%(TCL_LIBRARY)s && make install TCL_LIBRARY=%(TCL_LIBRARY)s DESTDIR=%(DESTDIR)s'%{
+                  "DESTDIR": shellQuote(os.path.join(WORKDIR, 'libraries')),
+                  "TCL_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tcl8.5'%(getVersion())),
+                  },
+              ),
+          dict(
+              name="Tk 8.5.15",
+              url="ftp://ftp.tcl.tk/pub/tcl//tcl8_5/tk8.5.15-src.tar.gz",
+              checksum='55b8e33f903210a4e1c8bce0f820657f',
+              buildDir="unix",
+              configure_pre=[
+                    '--enable-aqua',
+                    '--enable-shared',
+                    '--enable-threads',
+                    '--libdir=/Library/Frameworks/Python.framework/Versions/%s/lib'%(getVersion(),),
+              ],
+              useLDFlags=False,
+              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'%{
+                  "DESTDIR": shellQuote(os.path.join(WORKDIR, 'libraries')),
+                  "TCL_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tcl8.5'%(getVersion())),
+                  "TK_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tk8.5'%(getVersion())),
+                  },
+                ),
+        ])
+
     if getVersionTuple() >= (3, 3):
         result.extend([
           dict(
@@ -526,6 +564,20 @@
                 % frameworks['Tk'],
             ]
 
+    # For 10.6+ builds, we build two versions of _tkinter:
+    #    - the traditional version (renamed to _tkinter.so.framework) linked
+    #       with /Library/Frameworks/{Tcl,Tk}.framework
+    #    - the default version linked with our private copies of Tcl and Tk
+    if DEPTARGET > '10.5':
+        EXPECTED_SHARED_LIBS['_tkinter.so.framework'] = \
+            EXPECTED_SHARED_LIBS['_tkinter.so']
+        EXPECTED_SHARED_LIBS['_tkinter.so'] = [
+                "/Library/Frameworks/Python.framework/Versions/%s/lib/libtcl%s.dylib"
+                    % (getVersion(), frameworks['Tcl']),
+                "/Library/Frameworks/Python.framework/Versions/%s/lib/libtk%s.dylib"
+                    % (getVersion(), frameworks['Tk']),
+                ]
+
     # Remove inherited environment variables which might influence build
     environ_var_prefixes = ['CPATH', 'C_INCLUDE_', 'DYLD_', 'LANG', 'LC_',
                             'LD_', 'LIBRARY_', 'PATH', 'PYTHON']
@@ -634,13 +686,19 @@
 
     XXX: This function assumes that archives contain a toplevel directory
     that is has the same name as the basename of the archive. This is
-    save enough for anything we use.
+    safe enough for almost anything we use.  Unfortunately, it does not
+    work for current Tcl and Tk source releases where the basename of
+    the archive ends with "-src" but the uncompressed directory does not.
+    For now, just special case Tcl and Tk tar.gz downloads.
     """
     curdir = os.getcwd()
     try:
         os.chdir(builddir)
         if archiveName.endswith('.tar.gz'):
             retval = os.path.basename(archiveName[:-7])
+            if ((retval.startswith('tcl') or retval.startswith('tk'))
+                    and retval.endswith('-src')):
+                retval = retval[:-4]
             if os.path.exists(retval):
                 shutil.rmtree(retval)
             fp = os.popen("tar zxf %s 2>&1"%(shellQuote(archiveName),), 'r')
@@ -904,6 +962,23 @@
     print("Running make")
     runCommand("make")
 
+    # For deployment targets of 10.6 and higher, we build our own version
+    # of Tcl and Cocoa Aqua Tk libs because the Apple-supplied Tk 8.5 is
+    # out-of-date and has critical bugs.  Save the _tkinter.so that was
+    # linked with /Library/Frameworks/{Tck,Tk}.framework and build
+    # another _tkinter.so linked with our private Tcl and Tk libs.
+    if DEPTARGET > '10.5':
+        runCommand("find build -name '_tkinter.so' "
+                        " -execdir mv '{}' '{}'.framework \;")
+        print("Running make to rebuild _tkinter")
+        runCommand("make TCLTK_INCLUDES='-I%s/libraries/usr/local/include' "
+                "TCLTK_LIBS='-L%s/libraries/usr/local/lib -ltcl8.5 -ltk8.5'"%(
+            shellQuote(WORKDIR)[1:-1],
+            shellQuote(WORKDIR)[1:-1]))
+        # make a backup copy, just in case
+        runCommand("find build -name '_tkinter.so' "
+                        " -execdir cp -p '{}' '{}'.private \;")
+
     print("Running make install")
     runCommand("make install DESTDIR=%s"%(
         shellQuote(rootDir)))
diff --git a/Mac/BuildScript/resources/ReadMe.txt b/Mac/BuildScript/resources/ReadMe.txt
--- a/Mac/BuildScript/resources/ReadMe.txt
+++ b/Mac/BuildScript/resources/ReadMe.txt
@@ -2,10 +2,12 @@
 $MACOSX_DEPLOYMENT_TARGET for the following architecture(s):
 $ARCHITECTURES.
 
-Installation requires approximately $INSTALL_SIZE MB of disk space,
-ignore the message that it will take zero bytes.
+               **** IMPORTANT ****
 
-If you are attempting to install on an OS X 10.8 system, you may
+Installing on OS X 10.8 (Mountain Lion) or later systems
+========================================================
+
+If you are attempting to install on an OS X 10.8+ system, you may
 see a message that Python can't be installed because it is from an
 unidentified developer.  This is because this Python installer
 package is not yet compatible with the Gatekeeper security feature
@@ -15,22 +17,36 @@
 installer package icon.  Then select "Open using ... Installer" from
 the contextual menu that appears.
 
+       **** IMPORTANT changes if you use IDLE and Tkinter ****
+
+Installing a third-party version of Tcl/Tk is no longer required
+================================================================
+
+As of Python 3.3.3, the 10.6+ 64-bit installer now
+comes with its own private copy of Tcl and Tk 8.5 libraries.  For
+this version of Python, it is no longer necessary to install
+a third-party version of Tcl/Tk 8.5, such as those from ActiveState,
+to work around the problematic versions of Tcl/Tk 8.5 shipped by
+Apple in OS X 10.6 and later.  (This does not change the requirements
+for older versions of Python installed from python.org.)  By default,
+this version of Python will always use its own private version,
+regardless of whether a third-party Tcl/Tk is installed.
+The 10.5+ 32-bit-only installer continues to use Tcl/Tk 8.4,
+either a third-party or system-supplied version.
+
+Visit http://www.python.org/download/mac/tcltk/
+for current information about supported and recommended versions of
+Tcl/Tk for this version of Python and of Mac OS X.
+
+Using this version of Python on OS X
+====================================
+
 Python consists of the Python programming language interpreter, plus
 a set of programs to allow easy access to it for Mac users including
 an integrated development environment, IDLE, plus a set of pre-built
 extension modules that open up specific Macintosh technologies to
 Python programs.
 
-                    **** IMPORTANT ****
-                    
-To use IDLE or other programs that use the tkinter graphical user
-interface toolkit, you may need to install a third-party version of
-the Tcl/Tk frameworks.  Visit http://www.python.org/download/mac/tcltk/
-for current information about supported and recommended versions of
-Tcl/Tk for this version of Python and of Mac OS X.
-
-                    *******************
-
 The installer puts applications, an "Update Shell Profile" command,
 and a link to the optionally installed Python Documentation into the
 "Python $VERSION" subfolder of the system Applications folder,
@@ -41,12 +57,15 @@
 "bin" directory inside the framework to your shell's search path.
 
 You must install onto your current boot disk, even though the
-installer does not enforce this, otherwise things will not work.
+installer may not enforce this, otherwise things will not work.
 
 You can verify the integrity of the disk image file containing the
 installer package and this ReadMe file by comparing its md5 checksum
 and size with the values published on the release page linked at
 http://www.python.org/download/
 
+Installation requires approximately $INSTALL_SIZE MB of disk space,
+ignore the message that it will take zero bytes.
+
 More information on Python in general can be found at
 http://www.python.org.
diff --git a/Mac/BuildScript/resources/Welcome.rtf b/Mac/BuildScript/resources/Welcome.rtf
--- a/Mac/BuildScript/resources/Welcome.rtf
+++ b/Mac/BuildScript/resources/Welcome.rtf
@@ -1,7 +1,7 @@
-{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf470
-{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
 {\colortbl;\red255\green255\blue255;}
-\paperw11904\paperh16836\margl1440\margr1440\vieww9640\viewh10620\viewkind0
+\paperw11905\paperh16837\margl1440\margr1440\vieww9640\viewh10620\viewkind0
 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640
 
 \f0\fs24 \cf0 This package will install 
@@ -25,11 +25,7 @@
 \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.\
 \
 
-\b IMPORTANT:
-\b0  
-\b IDLE
-\b0  and other programs using the 
-\b tkinter
-\b0  graphical user interface toolkit require specific versions of the 
+\b IMPORTANT for users of IDLE and tkinter:
+\b0  As of Python 3.3.3, it is no longer necessary to install third-party versions of the 
 \b Tcl/Tk
-\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.}
\ No newline at end of file
+\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.}
\ No newline at end of file
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -595,6 +595,12 @@
 - Issue #1584: Provide options to override default search paths for
   Tcl and Tk when building _tkinter.
 
+- 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.
+
 
 What's New in Python 3.3.2?
 ===========================

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list