[Python-checkins] cpython (merge 3.4 -> default): Issue #22877: PEP 477 - keep 2.7 and 3.x installers in sync.

ned.deily python-checkins at python.org
Sat Nov 15 04:00:03 CET 2014


https://hg.python.org/cpython/rev/6270a2181ed3
changeset:   93490:6270a2181ed3
parent:      93487:97dc64adb6fe
parent:      93489:e8182c6c9ef1
user:        Ned Deily <nad at acm.org>
date:        Fri Nov 14 18:56:28 2014 -0800
summary:
  Issue #22877: PEP 477 - keep 2.7 and 3.x installers in sync.

files:
  Mac/BuildScript/build-installer.py           |  42 +++----
  Mac/BuildScript/scripts/postflight.ensurepip |  50 +++++----
  2 files changed, 46 insertions(+), 46 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
@@ -198,7 +198,7 @@
     LT_10_5 = bool(getDeptargetTuple() < (10, 5))
 
 #   Disable for now
-    if False:   # if (getDeptargetTuple() > (10, 5)) and (getVersionTuple() >= (3, 5)):
+    if False:   # if getDeptargetTuple() > (10, 5):
         result.extend([
           dict(
               name="Tcl 8.5.15",
@@ -239,7 +239,7 @@
                 ),
         ])
 
-    if getVersionTuple() >= (3, 3):
+    if PYTHON_3:
         result.extend([
           dict(
               name="XZ 5.0.5",
@@ -369,8 +369,6 @@
 # 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",
@@ -439,27 +437,23 @@
             topdir="/Library/Frameworks/Python.framework",
             source="/empty-dir",
             required=False,
-            selected=unselected_for_lt_python34,
+            selected='selected',
+        ),
+        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 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 getDeptargetTuple() < (10, 4) and not PYTHON_3:
         result.append(
             dict(
@@ -977,7 +971,7 @@
         shellQuote(os.path.join(SRCDIR, 'configure')), shellQuote(SDKPATH),
         UNIVERSALARCHS,
         (' ', '--with-computed-gotos ')[PYTHON_3],
-        (' ', '--without-ensurepip ')[getVersionTuple() >= (3, 4)],
+        (' ', '--without-ensurepip ')[PYTHON_3],
         shellQuote(WORKDIR)[1:-1],
         shellQuote(WORKDIR)[1:-1]))
 
@@ -1159,7 +1153,9 @@
     fp.close()
 
 def patchScript(inPath, outPath):
+    major, minor = getVersionMajorMinor()
     data = fileContents(inPath)
+    data = data.replace('@PYMAJOR@', str(major))
     data = data.replace('@PYVER@', getVersion())
     fp = open(outPath, 'w')
     fp.write(data)
diff --git a/Mac/BuildScript/scripts/postflight.ensurepip b/Mac/BuildScript/scripts/postflight.ensurepip
--- a/Mac/BuildScript/scripts/postflight.ensurepip
+++ b/Mac/BuildScript/scripts/postflight.ensurepip
@@ -4,7 +4,7 @@
 #
 
 PYVER="@PYVER@"
-PYMAJOR="3"
+PYMAJOR="@PYMAJOR@"
 FWK="/Library/Frameworks/Python.framework/Versions/${PYVER}"
 RELFWKBIN="../../..${FWK}/bin"
 
@@ -34,32 +34,36 @@
 
 if [ -d /usr/local/bin ] ; then
     (
+        install_links_if_our_fw() {
+            if [ "$(readlink -n ./$1)" = "${RELFWKBIN}/$1" ] ; then
+                shift
+                for fn ;
+                do
+                    if [ -e "${RELFWKBIN}/${fn}" ] ; then
+                        rm -f ./${fn}
+                        ln -s "${RELFWKBIN}/${fn}" "./${fn}"
+                        chgrp -h admin "./${fn}"
+                        chmod -h g+w "./${fn}"
+                    fi
+                done
+            fi
+        }
+
         cd /usr/local/bin
+
         # Create pipx.y and easy_install-x.y links if /usr/local/bin/pythonx.y
         #   is linked to this framework version
-        if [ "$(readlink -n ./python${PYVER})" = "${RELFWKBIN}/python${PYVER}" ] ; then
-            for fn in "pip${PYVER}" "easy_install-${PYVER}" ;
-            do
-                if [ -e "${RELFWKBIN}/${fn}" ] ; then
-                    rm -f ./${fn}
-                    ln -s "${RELFWKBIN}/${fn}" "./${fn}"
-                    chgrp -h admin "./${fn}"
-                    chmod -h g+w "./${fn}"
-                fi
-            done
-        fi
+        install_links_if_our_fw "python${PYVER}" \
+                                    "pip${PYVER}" "easy_install-${PYVER}"
+
         # Create pipx link if /usr/local/bin/pythonx is linked to this version
-        if [ "$(readlink -n ./python${PYMAJOR})" = "${RELFWKBIN}/python${PYMAJOR}" ] ; then
-            for fn in "pip${PYMAJOR}" ;
-            do
-                if [ -e "${RELFWKBIN}/${fn}" ] ; then
-                    rm -f ./${fn}
-                    ln -s "${RELFWKBIN}/${fn}" "./${fn}"
-                    chgrp -h admin "./${fn}"
-                    chmod -h g+w "./${fn}"
-                fi
-            done
-        fi
+        install_links_if_our_fw "python${PYMAJOR}" \
+                                    "pip${PYMAJOR}"
+
+        # Create pip and easy_install link if /usr/local/bin/python
+        #   is linked to this version
+        install_links_if_our_fw "python" \
+                                    "pip" "easy_install"
     )
 fi
 exit 0

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


More information about the Python-checkins mailing list