Issue #19551: PEP 453 - OS X installer now installs or upgrades pip by default.

This commit is contained in:
Ned Deily 2013-11-22 22:25:43 -08:00
parent 7bc4b3bee3
commit 41ab6c3b1a
4 changed files with 120 additions and 1 deletions

View File

@ -364,6 +364,7 @@ def library_recipes():
# Instructions for building packages inside the .mpkg.
def pkg_recipes():
unselected_for_python3 = ('selected', 'unselected')[PYTHON_3]
unselected_for_lt_python34 = ('selected', 'unselected')[getVersionTuple() < (3, 4)]
result = [
dict(
name="PythonFramework",
@ -432,10 +433,27 @@ def pkg_recipes():
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 +471,7 @@ def pkg_recipes():
selected=unselected_for_python3,
)
)
return result
def fatal(msg):
@ -955,11 +974,13 @@ def buildPython():
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]))

View File

@ -17,6 +17,37 @@ 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.
**NEW* As of Python 3.4.0b1:
New Installation Options and Defaults
=====================================
The Python installer now includes an option to automatically install
or upgrade pip, a tool for installing and managing Python packages.
This option is enabled by default and no Internet access is required.
If you do want the installer to do this, select the "Customize" option
at the "Installation Type" step and uncheck the "Install or ugprade
pip" option.
To make it easier to use scripts installed by third-party Python
packages, with pip or by other means, the "Shell profile updater"
option is now enabled by default, as has been the case with Python
2.7.x installers. You can also turn this option off by selecting
"Customize" and unchecking the "Shell profile updater" option. You can
also update your shell profile later by launching the "Update Shell
Profile" command found in the /Applications/Python $VERSION folder. You may
need to start a new terminal window for the changes to take effect.
Python.org Python $VERSION and 2.7.x versions can both be installed and
will not conflict. Command names for Python 3 contain a 3 in them,
python3 (or python$VERSION), idle3 (or idle$VERSION), pip3 (or pip$VERSION), etc.
Python 2.7 command names contain a 2 or no digit: python2 (or
python2.7 or python), idle2 (or idle2.7 or idle), etc. If you want to
use pip with Python 2.7.x, you will need to download and install a
separate copy of it from the Python Package Index
(https://pypi.python.org/pypi).
**** IMPORTANT changes if you use IDLE and Tkinter ****
Installing a third-party version of Tcl/Tk is no longer required

View File

@ -0,0 +1,65 @@
#!/bin/sh
#
# Install/upgrade pip.
#
PYVER="@PYVER@"
PYMAJOR="3"
FWK="/Library/Frameworks/Python.framework/Versions/${PYVER}"
RELFWKBIN="../../..${FWK}/bin"
umask 022
"${FWK}/bin/python${PYVER}" -m ensurepip --upgrade
"${FWK}/bin/python${PYVER}" -Wi \
"${FWK}/lib/python${PYVER}/compileall.py" \
-f -x badsyntax \
"${FWK}/lib/python${PYVER}/site-packages"
"${FWK}/bin/python${PYVER}" -Wi -O \
"${FWK}/lib/python${PYVER}/compileall.py" \
-f -x badsyntax \
"${FWK}/lib/python${PYVER}/site-packages"
chgrp -R admin "${FWK}/lib/python${PYVER}/site-packages" "${FWK}/bin"
chmod -R g+w "${FWK}/lib/python${PYVER}/site-packages" "${FWK}/bin"
# We do not know if the user selected the Python command-line tools
# package that installs symlinks to /usr/local/bin. So we assume
# that the command-line tools package has already completed or was
# not selected and we will only install /usr/local/bin symlinks for
# pip et al if there are /usr/local/bin/python* symlinks to our
# framework bin directory.
if [ -d /usr/local/bin ] ; then
(
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
# 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
)
fi
exit 0

View File

@ -395,6 +395,8 @@ Build
available to override the default ensurepip "--upgrade" option. The option
can also be set with "make [alt]install ENSUREPIP=[upgrade|install\no]".
- Issue #19551: PEP 453 - the OS X installer now installs pip by default.
Tools/Demos
-----------