Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
the system-provided Python.  Also, properly guard a new Python 3 only
installer build step so that build-installer.py can stay compatible
with the 2.7 version.  (with release manager approval for 3.2rc2)
diff --git a/Mac/BuildScript/README.txt b/Mac/BuildScript/README.txt
index c4f0b67..de2f5cb 100644
--- a/Mac/BuildScript/README.txt
+++ b/Mac/BuildScript/README.txt
@@ -14,7 +14,7 @@
 1.  32-bit-only, i386 and PPC universal, capable on running on all machines
     supported by Mac OS X 10.3.9 through (at least) 10.6::
 
-        python2.6 build-installer.py \
+        python build-installer.py \
             --sdk-path=/Developer/SDKs/MacOSX10.4u.sdk \
             --universal-archs=32-bit \
             --dep-target=10.3 
@@ -38,7 +38,7 @@
         * ``MacOSX10.4u`` SDK (later SDKs do not support PPC G3 processors)
         * ``MACOSX_DEPLOYMENT_TARGET=10.3``
         * Apple ``gcc-4.0``
-        * Python 2.6 for documentation build with Sphinx
+        * Python 2.n (n >= 4) for documentation build with Sphinx
 
     - alternate build environments:
 
@@ -48,7 +48,7 @@
 
 2.  64-bit / 32-bit, x86_64 and i386 universal, for OS X 10.6 (and later)::
 
-        python2.6 build-installer.py \
+        python build-installer.py \
             --sdk-path=/Developer/SDKs/MacOSX10.6.sdk \
             --universal-archs=intel \
             --dep-target=10.6
@@ -67,7 +67,7 @@
         * ``MacOSX10.6`` SDK
         * ``MACOSX_DEPLOYMENT_TARGET=10.6``
         * Apple ``gcc-4.2``
-        * Python 2.6 for documentation build with Sphinx
+        * Python 2.n (n >= 4) for documentation build with Sphinx
 
     - alternate build environments:
 
diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py
index 18b6803..f0b3f3f 100755
--- a/Mac/BuildScript/build-installer.py
+++ b/Mac/BuildScript/build-installer.py
@@ -1,12 +1,14 @@
 #!/usr/bin/python
 """
-This script is used to build the "official unofficial" universal build on
-Mac OS X. It requires Mac OS X 10.4, Xcode 2.2 and the 10.4u SDK to do its
-work.  64-bit or four-way universal builds require at least OS X 10.5 and
-the 10.5 SDK.
+This script is used to build "official" universal installers on Mac OS X.
+It requires at least Mac OS X 10.4, Xcode 2.2 and the 10.4u SDK for
+32-bit builds.  64-bit or four-way universal builds require at least
+OS X 10.5 and the 10.5 SDK.
 
-Please ensure that this script keeps working with Python 2.3, to avoid
-bootstrap issues (/usr/bin/python is Python 2.3 on OSX 10.4)
+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.
 
 Usage: see USAGE variable in the script.
 """
@@ -405,6 +407,9 @@
     Check that we're running on a supported system.
     """
 
+    if sys.version_info[0:2] < (2, 4):
+        fatal("This script must be run with Python 2.4 or later")
+
     if platform.system() != 'Darwin':
         fatal("This script should be run on a Mac OS X 10.4 (or later) system")
 
@@ -835,29 +840,33 @@
             os.chmod(p, stat.S_IMODE(st.st_mode) | stat.S_IWGRP)
             os.chown(p, -1, gid)
 
-    LDVERSION=None
-    VERSION=None
-    ABIFLAGS=None
+    if PYTHON_3:
+        LDVERSION=None
+        VERSION=None
+        ABIFLAGS=None
 
-    with open(os.path.join(buildDir, 'Makefile')) as fp:
+        fp = open(os.path.join(buildDir, 'Makefile'), 'r')
         for ln in fp:
             if ln.startswith('VERSION='):
                 VERSION=ln.split()[1]
             if ln.startswith('ABIFLAGS='):
                 ABIFLAGS=ln.split()[1]
-
             if ln.startswith('LDVERSION='):
                 LDVERSION=ln.split()[1]
+        fp.close()
 
-    LDVERSION = LDVERSION.replace('$(VERSION)', VERSION)
-    LDVERSION = LDVERSION.replace('$(ABIFLAGS)', ABIFLAGS)
+        LDVERSION = LDVERSION.replace('$(VERSION)', VERSION)
+        LDVERSION = LDVERSION.replace('$(ABIFLAGS)', ABIFLAGS)
+        config_suffix = '-' + LDVERSION
+    else:
+        config_suffix = ''      # Python 2.x
 
     # We added some directories to the search path during the configure
     # phase. Remove those because those directories won't be there on
     # the end-users system.
     path =os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework',
                 'Versions', version, 'lib', 'python%s'%(version,),
-                'config-' + LDVERSION, 'Makefile')
+                'config' + config_suffix, 'Makefile')
     fp = open(path, 'r')
     data = fp.read()
     fp.close()
diff --git a/Misc/NEWS b/Misc/NEWS
index c0b0bfe..49e2341 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -73,6 +73,13 @@
 - Issue #9509: argparse now properly handles IOErrors raised by
   argparse.FileType.
 
+Build
+-----
+
+- Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
+  the system-provided Python.
+
+
 What's New in Python 3.2 Release Candidate 1
 ============================================