Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 41ab6c3

Browse files
committed
Issue #19551: PEP 453 - OS X installer now installs or upgrades pip by default.
1 parent 7bc4b3b commit 41ab6c3

4 files changed

Lines changed: 120 additions & 1 deletion

File tree

Mac/BuildScript/build-installer.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ def library_recipes():
364364
# Instructions for building packages inside the .mpkg.
365365
def pkg_recipes():
366366
unselected_for_python3 = ('selected', 'unselected')[PYTHON_3]
367+
unselected_for_lt_python34 = ('selected', 'unselected')[getVersionTuple() < (3, 4)]
367368
result = [
368369
dict(
369370
name="PythonFramework",
@@ -432,10 +433,27 @@ def pkg_recipes():
432433
topdir="/Library/Frameworks/Python.framework",
433434
source="/empty-dir",
434435
required=False,
435-
selected=unselected_for_python3,
436+
selected=unselected_for_lt_python34,
436437
),
437438
]
438439

440+
if getVersionTuple() >= (3, 4):
441+
result.append(
442+
dict(
443+
name="PythonInstallPip",
444+
long_name="Install or upgrade pip",
445+
readme="""\
446+
This package installs (or upgrades from an earlier version)
447+
pip, a tool for installing and managing Python packages.
448+
""",
449+
postflight="scripts/postflight.ensurepip",
450+
topdir="/Library/Frameworks/Python.framework",
451+
source="/empty-dir",
452+
required=False,
453+
selected='selected',
454+
)
455+
)
456+
439457
if DEPTARGET < '10.4' and not PYTHON_3:
440458
result.append(
441459
dict(
@@ -453,6 +471,7 @@ def pkg_recipes():
453471
selected=unselected_for_python3,
454472
)
455473
)
474+
456475
return result
457476

458477
def fatal(msg):
@@ -955,11 +974,13 @@ def buildPython():
955974
runCommand("%s -C --enable-framework --enable-universalsdk=%s "
956975
"--with-universal-archs=%s "
957976
"%s "
977+
"%s "
958978
"LDFLAGS='-g -L%s/libraries/usr/local/lib' "
959979
"CFLAGS='-g -I%s/libraries/usr/local/include' 2>&1"%(
960980
shellQuote(os.path.join(SRCDIR, 'configure')), shellQuote(SDKPATH),
961981
UNIVERSALARCHS,
962982
(' ', '--with-computed-gotos ')[PYTHON_3],
983+
(' ', '--without-ensurepip ')[getVersionTuple() >= (3, 4)],
963984
shellQuote(WORKDIR)[1:-1],
964985
shellQuote(WORKDIR)[1:-1]))
965986

Mac/BuildScript/resources/ReadMe.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,37 @@ instead of double-clicking, control-click or right click the "Python"
1717
installer package icon. Then select "Open using ... Installer" from
1818
the contextual menu that appears.
1919

20+
**NEW* As of Python 3.4.0b1:
21+
22+
New Installation Options and Defaults
23+
=====================================
24+
25+
The Python installer now includes an option to automatically install
26+
or upgrade pip, a tool for installing and managing Python packages.
27+
This option is enabled by default and no Internet access is required.
28+
If you do want the installer to do this, select the "Customize" option
29+
at the "Installation Type" step and uncheck the "Install or ugprade
30+
pip" option.
31+
32+
To make it easier to use scripts installed by third-party Python
33+
packages, with pip or by other means, the "Shell profile updater"
34+
option is now enabled by default, as has been the case with Python
35+
2.7.x installers. You can also turn this option off by selecting
36+
"Customize" and unchecking the "Shell profile updater" option. You can
37+
also update your shell profile later by launching the "Update Shell
38+
Profile" command found in the /Applications/Python $VERSION folder. You may
39+
need to start a new terminal window for the changes to take effect.
40+
41+
Python.org Python $VERSION and 2.7.x versions can both be installed and
42+
will not conflict. Command names for Python 3 contain a 3 in them,
43+
python3 (or python$VERSION), idle3 (or idle$VERSION), pip3 (or pip$VERSION), etc.
44+
Python 2.7 command names contain a 2 or no digit: python2 (or
45+
python2.7 or python), idle2 (or idle2.7 or idle), etc. If you want to
46+
use pip with Python 2.7.x, you will need to download and install a
47+
separate copy of it from the Python Package Index
48+
(https://pypi.python.org/pypi).
49+
50+
2051
**** IMPORTANT changes if you use IDLE and Tkinter ****
2152

2253
Installing a third-party version of Tcl/Tk is no longer required
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/sh
2+
#
3+
# Install/upgrade pip.
4+
#
5+
6+
PYVER="@PYVER@"
7+
PYMAJOR="3"
8+
FWK="/Library/Frameworks/Python.framework/Versions/${PYVER}"
9+
RELFWKBIN="../../..${FWK}/bin"
10+
11+
umask 022
12+
13+
"${FWK}/bin/python${PYVER}" -m ensurepip --upgrade
14+
15+
"${FWK}/bin/python${PYVER}" -Wi \
16+
"${FWK}/lib/python${PYVER}/compileall.py" \
17+
-f -x badsyntax \
18+
"${FWK}/lib/python${PYVER}/site-packages"
19+
20+
"${FWK}/bin/python${PYVER}" -Wi -O \
21+
"${FWK}/lib/python${PYVER}/compileall.py" \
22+
-f -x badsyntax \
23+
"${FWK}/lib/python${PYVER}/site-packages"
24+
25+
chgrp -R admin "${FWK}/lib/python${PYVER}/site-packages" "${FWK}/bin"
26+
chmod -R g+w "${FWK}/lib/python${PYVER}/site-packages" "${FWK}/bin"
27+
28+
# We do not know if the user selected the Python command-line tools
29+
# package that installs symlinks to /usr/local/bin. So we assume
30+
# that the command-line tools package has already completed or was
31+
# not selected and we will only install /usr/local/bin symlinks for
32+
# pip et al if there are /usr/local/bin/python* symlinks to our
33+
# framework bin directory.
34+
35+
if [ -d /usr/local/bin ] ; then
36+
(
37+
cd /usr/local/bin
38+
# Create pipx.y and easy_install-x.y links if /usr/local/bin/pythonx.y
39+
# is linked to this framework version
40+
if [ "$(readlink -n ./python${PYVER})" = "${RELFWKBIN}/python${PYVER}" ] ; then
41+
for fn in "pip${PYVER}" "easy_install-${PYVER}" ;
42+
do
43+
if [ -e "${RELFWKBIN}/${fn}" ] ; then
44+
rm -f ./${fn}
45+
ln -s "${RELFWKBIN}/${fn}" "./${fn}"
46+
chgrp -h admin "./${fn}"
47+
chmod -h g+w "./${fn}"
48+
fi
49+
done
50+
fi
51+
# Create pipx link if /usr/local/bin/pythonx is linked to this version
52+
if [ "$(readlink -n ./python${PYMAJOR})" = "${RELFWKBIN}/python${PYMAJOR}" ] ; then
53+
for fn in "pip${PYMAJOR}" ;
54+
do
55+
if [ -e "${RELFWKBIN}/${fn}" ] ; then
56+
rm -f ./${fn}
57+
ln -s "${RELFWKBIN}/${fn}" "./${fn}"
58+
chgrp -h admin "./${fn}"
59+
chmod -h g+w "./${fn}"
60+
fi
61+
done
62+
fi
63+
)
64+
fi
65+
exit 0

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,8 @@ Build
395395
available to override the default ensurepip "--upgrade" option. The option
396396
can also be set with "make [alt]install ENSUREPIP=[upgrade|install\no]".
397397

398+
- Issue #19551: PEP 453 - the OS X installer now installs pip by default.
399+
398400
Tools/Demos
399401
-----------
400402

0 commit comments

Comments
 (0)