[Python-checkins] cpython (2.7): Issue #20644: Keep build-installer.py in sync across active versions.

ned.deily python-checkins at python.org
Thu Apr 10 01:23:57 CEST 2014


http://hg.python.org/cpython/rev/88572ccb8ebe
changeset:   90199:88572ccb8ebe
branch:      2.7
user:        Ned Deily <nad at acm.org>
date:        Wed Apr 09 16:12:11 2014 -0700
summary:
  Issue #20644: Keep build-installer.py in sync across active versions.

files:
  Mac/BuildScript/build-installer.py |  127 ++++++----------
  1 files changed, 50 insertions(+), 77 deletions(-)


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
@@ -8,7 +8,9 @@
 Please ensure that this script keeps working with Python 2.5, to avoid
 bootstrap issues (/usr/bin/python is Python 2.5 on OSX 10.5).  Sphinx,
 which is used to build the documentation, currently requires at least
-Python 2.4.
+Python 2.4.  However, as of Python 3.4.1, Doc builds require an external
+sphinx-build and the current versions of Sphinx now require at least
+Python 2.6.
 
 In addition to what is supplied with OS X 10.5+ and Xcode 3+, the script
 requires an installed version of hg and a third-party version of
@@ -21,8 +23,8 @@
 
 32-bit-only installer builds are still possible on OS X 10.4 with Xcode 2.5
 and the installation of additional components, such as a newer Python
-(2.5 is needed for Python parser updates), hg, and svn (for the documentation
-build).
+(2.5 is needed for Python parser updates), hg, and for the documentation
+build either svn (pre-3.4.1) or sphinx-build (3.4.1 and later).
 
 Usage: see USAGE variable in the script.
 """
@@ -193,7 +195,8 @@
 
     LT_10_5 = bool(DEPTARGET < '10.5')
 
-    if (DEPTARGET > '10.5') and (getVersionTuple() >= (3, 4)):
+#   Disable for now
+    if False:   # if (DEPTARGET > '10.5') and (getVersionTuple() >= (3, 5)):
         result.extend([
           dict(
               name="Tcl 8.5.15",
@@ -237,9 +240,9 @@
     if getVersionTuple() >= (3, 3):
         result.extend([
           dict(
-              name="XZ 5.0.3",
-              url="http://tukaani.org/xz/xz-5.0.3.tar.gz",
-              checksum='fefe52f9ecd521de2a8ce38c21a27574',
+              name="XZ 5.0.5",
+              url="http://tukaani.org/xz/xz-5.0.5.tar.gz",
+              checksum='19d924e066b6fff0bc9d1981b4e53196',
               configure_pre=[
                     '--disable-dependency-tracking',
               ]
@@ -282,9 +285,9 @@
                   ),
           ),
           dict(
-              name="SQLite 3.7.13",
-              url="http://www.sqlite.org/sqlite-autoconf-3071300.tar.gz",
-              checksum='c97df403e8a3d5b67bb408fcd6aabd8e',
+              name="SQLite 3.8.3.1",
+              url="http://www.sqlite.org/2014/sqlite-autoconf-3080301.tar.gz",
+              checksum='509ff98d8dc9729b618b7e96612079c6',
               extra_cflags=('-Os '
                             '-DSQLITE_ENABLE_FTS4 '
                             '-DSQLITE_ENABLE_FTS3_PARENTHESIS '
@@ -364,6 +367,8 @@
 # Instructions for building packages inside the .mpkg.
 def pkg_recipes():
     unselected_for_python3 = ('selected', 'unselected')[PYTHON_3]
+    # unselected if 3.0 through 3.3, selected otherwise (2.x or >= 3.4)
+    unselected_for_lt_python34 = ('selected', 'unselected')[(3, 0) <= getVersionTuple() < (3, 4)]
     result = [
         dict(
             name="PythonFramework",
@@ -432,10 +437,27 @@
             topdir="/Library/Frameworks/Python.framework",
             source="/empty-dir",
             required=False,
-            selected=unselected_for_python3,
+            selected=unselected_for_lt_python34,
         ),
     ]
 
+    if getVersionTuple() >= (3, 4):
+        result.append(
+            dict(
+                name="PythonInstallPip",
+                long_name="Install or upgrade pip",
+                readme="""\
+                    This package installs (or upgrades from an earlier version)
+                    pip, a tool for installing and managing Python packages.
+                    """,
+                postflight="scripts/postflight.ensurepip",
+                topdir="/Library/Frameworks/Python.framework",
+                source="/empty-dir",
+                required=False,
+                selected='selected',
+            )
+        )
+
     if DEPTARGET < '10.4' and not PYTHON_3:
         result.append(
             dict(
@@ -453,6 +475,7 @@
                 selected=unselected_for_python3,
             )
         )
+
     return result
 
 def fatal(msg):
@@ -567,20 +590,6 @@
                 % frameworks['Tk'],
             ]
 
-    # For 10.6+ builds, we build two versions of _tkinter:
-    #    - the traditional version (renamed to _tkinter_library.so) linked
-    #       with /Library/Frameworks/{Tcl,Tk}.framework
-    #    - the default version linked with our builtin copies of Tcl and Tk
-    if (DEPTARGET > '10.5') and (getVersionTuple() >= (3, 4)):
-        EXPECTED_SHARED_LIBS['_tkinter_library.so'] = \
-            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']
@@ -601,7 +610,11 @@
         base_path = base_path + ':' + OLD_DEVELOPER_TOOLS
     os.environ['PATH'] = base_path
     print("Setting default PATH: %s"%(os.environ['PATH']))
-
+    # Ensure ws have access to hg and to sphinx-build.
+    # You may have to create links in /usr/bin for them.
+    runCommand('hg --version')
+    if getVersionTuple() >= (3, 4):
+        runCommand('sphinx-build --version')
 
 def parseOptions(args=None):
     """
@@ -914,8 +927,15 @@
     docdir = os.path.join(rootDir, 'pydocs')
     curDir = os.getcwd()
     os.chdir(buildDir)
-    runCommand('make update')
-    runCommand("make html PYTHON='%s'" % os.path.abspath(sys.executable))
+    # The Doc build changed for 3.4 (technically, for 3.4.1)
+    if getVersionTuple() < (3, 4):
+        # This step does an svn checkout of sphinx and its dependencies
+        runCommand('make update')
+        runCommand("make html PYTHON='%s'" % os.path.abspath(sys.executable))
+    else:
+        runCommand('make clean')
+        # Assume sphinx-build is on our PATH, checked in checkEnvironment
+        runCommand('make html')
     os.chdir(curDir)
     if not os.path.exists(docdir):
         os.mkdir(docdir)
@@ -955,34 +975,19 @@
     runCommand("%s -C --enable-framework --enable-universalsdk=%s "
                "--with-universal-archs=%s "
                "%s "
+               "%s "
                "LDFLAGS='-g -L%s/libraries/usr/local/lib' "
                "CFLAGS='-g -I%s/libraries/usr/local/include' 2>&1"%(
         shellQuote(os.path.join(SRCDIR, 'configure')), shellQuote(SDKPATH),
         UNIVERSALARCHS,
         (' ', '--with-computed-gotos ')[PYTHON_3],
+        (' ', '--without-ensurepip ')[getVersionTuple() >= (3, 4)],
         shellQuote(WORKDIR)[1:-1],
         shellQuote(WORKDIR)[1:-1]))
 
     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 builtin Tcl and Tk libs.
-    if (DEPTARGET > '10.5') and (getVersionTuple() >= (3, 4)):
-        runCommand("find build -name '_tkinter.so' "
-                        " -execdir mv '{}' _tkinter_library.so \;")
-        print("Running make to build builtin _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 copy which will be moved to lib-tkinter later
-        runCommand("find build -name '_tkinter.so' "
-                        " -execdir cp -p '{}' _tkinter_builtin.so \;")
-
     print("Running make install")
     runCommand("make install DESTDIR=%s"%(
         shellQuote(rootDir)))
@@ -1007,27 +1012,11 @@
                                 'Python.framework', 'Versions',
                                 version, 'lib', 'python%s'%(version,))
 
-    # If we made multiple versions of _tkinter, move them to
-    # their own directories under python lib.  This allows
-    # users to select which to import by manipulating sys.path
-    # directly or with PYTHONPATH.
-
-    if (DEPTARGET > '10.5') and (getVersionTuple() >= (3, 4)):
-        TKINTERS = ['builtin', 'library']
-        tkinter_moves = [('_tkinter_' + tkn + '.so',
-                             os.path.join(path_to_lib, 'lib-tkinter', tkn))
-                         for tkn in TKINTERS]
-        # Create the destination directories under lib-tkinter.
-        # The permissions and uid/gid will be fixed up next.
-        for tkm in tkinter_moves:
-            os.makedirs(tkm[1])
-
     print("Fix file modes")
     frmDir = os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework')
     gid = grp.getgrnam('admin').gr_gid
 
     shared_lib_error = False
-    moves_list = []
     for dirpath, dirnames, filenames in os.walk(frmDir):
         for dn in dirnames:
             os.chmod(os.path.join(dirpath, dn), STAT_0o775)
@@ -1053,25 +1042,9 @@
                                 % (sl, p))
                         shared_lib_error = True
 
-            # If this is a _tkinter variant, move it to its own directory
-            # now that we have fixed its permissions and checked that it
-            # was linked properly.  The directory was created earlier.
-            # The files are moved after the entire tree has been walked
-            # since the shared library checking depends on the files
-            # having unique names.
-            if (DEPTARGET > '10.5') and (getVersionTuple() >= (3, 4)):
-                for tkm in tkinter_moves:
-                    if fn == tkm[0]:
-                        moves_list.append(
-                            (p, os.path.join(tkm[1], '_tkinter.so')))
-
     if shared_lib_error:
         fatal("Unexpected shared library errors.")
 
-    # Now do the moves.
-    for ml in moves_list:
-        shutil.move(ml[0], ml[1])
-
     if PYTHON_3:
         LDVERSION=None
         VERSION=None

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


More information about the Python-checkins mailing list