From 65657c27fabc9d2419d1616c7e0e3915998047e0 Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Fri, 25 Oct 2013 00:34:44 -0700 Subject: Issue #1584: Provide options to override default search paths for Tcl and Tk when building _tkinter. configure has two new options; if used, both must be specified: ./configure \ --with-tcltk-includes="-I/opt/local/include" \ --with-tcltk-libs="-L/opt/local/lib -ltcl8.5 -ltk8.5" In addition, the options can be overridden with make: make \ TCLTK_INCLUDES="-I/opt/local/include" \ TCLTK_LIBS="-L/opt/local/lib -ltcl8.6 -ltk8.6" --- Makefile.pre.in | 5 +++++ Misc/NEWS | 3 +++ configure | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 28 ++++++++++++++++++++++++++++ setup.py | 43 ++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 126 insertions(+), 1 deletion(-) diff --git a/Makefile.pre.in b/Makefile.pre.in index ffaf8fef..27dd75f 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -208,6 +208,10 @@ _PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@ BUILD_GNU_TYPE= @build@ HOST_GNU_TYPE= @host@ +# Tcl and Tk config info from --with-tcltk-includes and -libs options +TCLTK_INCLUDES= @TCLTK_INCLUDES@ +TCLTK_LIBS= @TCLTK_LIBS@ + # The task to run while instrument when building the profile-opt target PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck #PROFILE_TASK= $(srcdir)/Lib/test/regrtest.py @@ -493,6 +497,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt *) quiet="";; \ esac; \ $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ + _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build # Build static library diff --git a/Misc/NEWS b/Misc/NEWS index 854a4a0..2f2c932 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -592,6 +592,9 @@ Build - Issue #15172: Document NASM 2.10+ as requirement for building OpenSSL 1.0.1 on Windows. +- Issue #1584: Provide options to override default search paths for + Tcl and Tk when building _tkinter. + What's New in Python 3.3.2? =========================== diff --git a/configure b/configure index 9bffbf3..cb03b49 100755 --- a/configure +++ b/configure @@ -644,6 +644,8 @@ LDLAST USE_THREAD_MODULE SIGNAL_OBJS USE_SIGNAL_MODULE +TCLTK_LIBS +TCLTK_INCLUDES LIBFFI_INCLUDEDIR PKG_CONFIG SHLIBS @@ -793,6 +795,8 @@ with_system_expat with_system_ffi with_system_libmpdec enable_loadable_sqlite_extensions +with_tcltk_includes +with_tcltk_libs with_dbmliborder with_signal_module with_threads @@ -1465,6 +1469,10 @@ Optional Packages: --with-system-ffi build _ctypes module using an installed ffi library --with-system-libmpdec build _decimal module using an installed libmpdec library + --with-tcltk-includes='-I...' + override search for Tcl and Tk include files + --with-tcltk-libs='-L...' + override search for Tcl and Tk libs --with-dbmliborder=db1:db2:... order to check db backends for dbm. Valid value is a colon separated string with the backend names @@ -9222,6 +9230,46 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_loadable_sqlite_extensions" >&5 $as_echo "$enable_loadable_sqlite_extensions" >&6; } +# Check for --with-tcltk-includes=path and --with-tcltk-libs=path + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-tcltk-includes" >&5 +$as_echo_n "checking for --with-tcltk-includes... " >&6; } + +# Check whether --with-tcltk-includes was given. +if test "${with_tcltk_includes+set}" = set; then : + withval=$with_tcltk_includes; +else + with_tcltk_includes="default" +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_tcltk_includes" >&5 +$as_echo "$with_tcltk_includes" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-tcltk-libs" >&5 +$as_echo_n "checking for --with-tcltk-libs... " >&6; } + +# Check whether --with-tcltk-libs was given. +if test "${with_tcltk_libs+set}" = set; then : + withval=$with_tcltk_libs; +else + with_tcltk_libs="default" +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_tcltk_libs" >&5 +$as_echo "$with_tcltk_libs" >&6; } +if test "x$with_tcltk_includes" = xdefault || test "x$with_tcltk_libs" = xdefault +then + if test "x$with_tcltk_includes" != "x$with_tcltk_libs" + then + as_fn_error $? "use both --with-tcltk-includes='...' and --with-tcltk-libs='...' or neither" "$LINENO" 5 + fi + TCLTK_INCLUDES="" + TCLTK_LIBS="" +else + TCLTK_INCLUDES="$with_tcltk_includes" + TCLTK_LIBS="$with_tcltk_libs" +fi + # Check for --with-dbmliborder { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-dbmliborder" >&5 $as_echo_n "checking for --with-dbmliborder... " >&6; } diff --git a/configure.ac b/configure.ac index b53dee2..3023dc6 100644 --- a/configure.ac +++ b/configure.ac @@ -2270,6 +2270,34 @@ AC_ARG_ENABLE(loadable-sqlite-extensions, AC_MSG_RESULT($enable_loadable_sqlite_extensions) +# Check for --with-tcltk-includes=path and --with-tcltk-libs=path +AC_SUBST(TCLTK_INCLUDES) +AC_SUBST(TCLTK_LIBS) +AC_MSG_CHECKING(for --with-tcltk-includes) +AC_ARG_WITH(tcltk-includes, + AS_HELP_STRING([--with-tcltk-includes='-I...'], [override search for Tcl and Tk include files]), + [], + [with_tcltk_includes="default"]) +AC_MSG_RESULT($with_tcltk_includes) +AC_MSG_CHECKING(for --with-tcltk-libs) +AC_ARG_WITH(tcltk-libs, + AS_HELP_STRING([--with-tcltk-libs='-L...'], [override search for Tcl and Tk libs]), + [], + [with_tcltk_libs="default"]) +AC_MSG_RESULT($with_tcltk_libs) +if test "x$with_tcltk_includes" = xdefault || test "x$with_tcltk_libs" = xdefault +then + if test "x$with_tcltk_includes" != "x$with_tcltk_libs" + then + AC_MSG_ERROR([use both --with-tcltk-includes='...' and --with-tcltk-libs='...' or neither]) + fi + TCLTK_INCLUDES="" + TCLTK_LIBS="" +else + TCLTK_INCLUDES="$with_tcltk_includes" + TCLTK_LIBS="$with_tcltk_libs" +fi + # Check for --with-dbmliborder AC_MSG_CHECKING(for --with-dbmliborder) AC_ARG_WITH(dbmliborder, diff --git a/setup.py b/setup.py index fe2dd6e..19a7b29 100644 --- a/setup.py +++ b/setup.py @@ -1538,6 +1538,41 @@ class PyBuildExt(build_ext): return missing + def detect_tkinter_explicitly(self): + # Build _tkinter using explicit locations for Tcl/Tk. + # + # This is enabled when both arguments are given to ./configure: + # + # --with-tcltk-includes="-I/path/to/tclincludes \ + # -I/path/to/tkincludes" + # --with-tcltk-libs="-L/path/to/tcllibs -ltclm.n \ + # -L/path/to/tklibs -ltkm.n" + # + # These values can also be specified or overriden via make: + # make TCLTK_INCLUDES="..." TCLTK_LIBS="..." + # + # This can be useful for building and testing tkinter with multiple + # versions of Tcl/Tk. Note that a build of Tk depends on a particular + # build of Tcl so you need to specify both arguments and use care when + # overriding. + + # The _TCLTK variables are created in the Makefile sharedmods target. + tcltk_includes = os.environ.get('_TCLTK_INCLUDES') + tcltk_libs = os.environ.get('_TCLTK_LIBS') + if not (tcltk_includes and tcltk_libs): + # Resume default configuration search. + return 0 + + extra_compile_args = tcltk_includes.split() + extra_link_args = tcltk_libs.split() + ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], + define_macros=[('WITH_APPINIT', 1)], + extra_compile_args = extra_compile_args, + extra_link_args = extra_link_args, + ) + self.extensions.append(ext) + return 1 + def detect_tkinter_darwin(self, inc_dirs, lib_dirs): # The _tkinter module, using frameworks. Since frameworks are quite # different the UNIX search logic is not sharable. @@ -1627,10 +1662,16 @@ class PyBuildExt(build_ext): self.extensions.append(ext) return 1 - def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module. + # Check whether --with-tcltk-includes and --with-tcltk-libs were + # configured or passed into the make target. If so, use these values + # to build tkinter and bypass the searches for Tcl and TK in standard + # locations. + if self.detect_tkinter_explicitly(): + return + # Rather than complicate the code below, detecting and building # AquaTk is a separate method. Only one Tkinter will be built on # Darwin - either AquaTk, if it is found, or X11 based Tk. -- cgit v0.12 From 5b3582c919c7bb023d2e8d38d25d65bcc5125131 Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Fri, 25 Oct 2013 00:41:46 -0700 Subject: 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. --- 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 index fa04b97..9d1f59c 100644 --- a/Mac/BuildScript/README.txt +++ b/Mac/BuildScript/README.txt @@ -57,13 +57,40 @@ for each release. * 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 @@ for each release. 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 index a9d4091..de1a980 100755 --- a/Mac/BuildScript/build-installer.py +++ b/Mac/BuildScript/build-installer.py @@ -193,6 +193,44 @@ def library_recipes(): 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 @@ def checkEnvironment(): % 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 @@ def extractArchive(builddir, archiveName): 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 @@ def buildPython(): 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 index 9ac52d0..e5c49f0 100644 --- a/Mac/BuildScript/resources/ReadMe.txt +++ b/Mac/BuildScript/resources/ReadMe.txt @@ -2,10 +2,12 @@ This package will install Python $FULL_VERSION for Mac OS X $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 **** + +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 +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 @@ instead of double-clicking, control-click or right click the "Python" 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 @@ well. Double-click on the "Update Shell Profile" command to add the "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 index 86fbf63..c3b4b7c 100644 --- 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 @@ See the ReadMe file and the Python documentation for more information.\ \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 index 2f2c932..0e6203b 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -595,6 +595,12 @@ Build - 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? =========================== -- cgit v0.12 From 4b7a02314933c4e96a194e4aba063cd8f89bc132 Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Fri, 25 Oct 2013 00:46:02 -0700 Subject: Issue #19019: Change the OS X installer build script to use CFLAGS instead of OPT for special build options. By setting OPT, some compiler-specific options like -fwrapv were overridden and thus not used, which could result in broken interpreters when building with clang. --- Mac/BuildScript/build-installer.py | 2 +- Misc/NEWS | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py index de1a980..3e728e0 100755 --- a/Mac/BuildScript/build-installer.py +++ b/Mac/BuildScript/build-installer.py @@ -952,7 +952,7 @@ def buildPython(): "--with-universal-archs=%s " "%s " "LDFLAGS='-g -L%s/libraries/usr/local/lib' " - "OPT='-g -O3 -I%s/libraries/usr/local/include' 2>&1"%( + "CFLAGS='-g -I%s/libraries/usr/local/include' 2>&1"%( shellQuote(os.path.join(SRCDIR, 'configure')), shellQuote(SDKPATH), UNIVERSALARCHS, (' ', '--with-computed-gotos ')[PYTHON_3], diff --git a/Misc/NEWS b/Misc/NEWS index 0e6203b..fbe5924 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -601,6 +601,11 @@ Build problems in the Apple-supplied Tcl/Tk 8.5 shipped in OS X 10.6 and later releases. +- Issue #19019: Change the OS X installer build script to use CFLAGS instead + of OPT for special build options. By setting OPT, some compiler-specific + options like -fwrapv were overridden and thus not used, which could result + in broken interpreters when building with clang. + What's New in Python 3.3.2? =========================== -- cgit v0.12 From a4f6b006e1e9a6e9dd82a95714e55f18b008278c Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Fri, 25 Oct 2013 00:47:38 -0700 Subject: Sync 2.7.x, 3.3.x, and 3.4.x versions of OS X build-installer.py. --- Mac/BuildScript/build-installer.py | 56 ++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 8 deletions(-) diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py index 3e728e0..ddb067d 100755 --- a/Mac/BuildScript/build-installer.py +++ b/Mac/BuildScript/build-installer.py @@ -1058,22 +1058,62 @@ def buildPython(): # the end-users system. Also remove the directories from _sysconfigdata.py # (added in 3.3) if it exists. + include_path = '-I%s/libraries/usr/local/include' % (WORKDIR,) + lib_path = '-L%s/libraries/usr/local/lib' % (WORKDIR,) + path_to_lib = os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework', 'Versions', version, 'lib', 'python%s'%(version,)) - paths = [os.path.join(path_to_lib, 'config' + config_suffix, 'Makefile'), - os.path.join(path_to_lib, '_sysconfigdata.py')] - for path in paths: - if not os.path.exists(path): - continue + + # fix Makefile + path = os.path.join(path_to_lib, 'config' + config_suffix, 'Makefile') + fp = open(path, 'r') + data = fp.read() + fp.close() + + for p in (include_path, lib_path): + data = data.replace(" " + p, '') + data = data.replace(p + " ", '') + + fp = open(path, 'w') + fp.write(data) + fp.close() + + # fix _sysconfigdata if it exists + # + # TODO: make this more robust! test_sysconfig_module of + # distutils.tests.test_sysconfig.SysconfigTestCase tests that + # the output from get_config_var in both sysconfig and + # distutils.sysconfig is exactly the same for both CFLAGS and + # LDFLAGS. The fixing up is now complicated by the pretty + # printing in _sysconfigdata.py. Also, we are using the + # pprint from the Python running the installer build which + # may not cosmetically format the same as the pprint in the Python + # being built (and which is used to originally generate + # _sysconfigdata.py). + + import pprint + path = os.path.join(path_to_lib, '_sysconfigdata.py') + if os.path.exists(path): fp = open(path, 'r') data = fp.read() fp.close() + # create build_time_vars dict + exec(data) + vars = {} + for k, v in build_time_vars.items(): + if type(v) == type(''): + for p in (include_path, lib_path): + v = v.replace(' ' + p, '') + v = v.replace(p + ' ', '') + vars[k] = v - data = data.replace(' -L%s/libraries/usr/local/lib'%(WORKDIR,), '') - data = data.replace(' -I%s/libraries/usr/local/include'%(WORKDIR,), '') fp = open(path, 'w') - fp.write(data) + # duplicated from sysconfig._generate_posix_vars() + fp.write('# system configuration generated and used by' + ' the sysconfig module\n') + fp.write('build_time_vars = ') + pprint.pprint(vars, stream=fp) fp.close() # Add symlinks in /usr/local/bin, using relative links -- cgit v0.12