Skip to content

Commit 322f5ba

Browse files
committed
Issue python#19553: PEP 453 - "make install" and "make altinstall" now install or
upgrade pip by default, using the bundled pip provided by the new ensurepip module. A new configure option, --with-ensurepip[=upgrade|install|no], is available to override the default ensurepip "--upgrade" option. The option can also be set with "make [alt]install ENSUREPIP=[upgrade|install\no]".
1 parent b8f944f commit 322f5ba

File tree

5 files changed

+99
-4
lines changed

5 files changed

+99
-4
lines changed

Mac/Makefile.in

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
VERSION=@VERSION@
66
ABIFLAGS=@ABIFLAGS@
77
LDVERSION=@LDVERSION@
8+
ENSUREPIP=@ENSUREPIP@
89
builddir = ..
910
srcdir=@srcdir@
1011
prefix=@prefix@
@@ -92,6 +93,16 @@ installunixtools:
9293
$(LN) -s $(BINDIR)/$${fn} $${fn} ;\
9394
done ;\
9495
fi
96+
-if test "x$(ENSUREPIP)" != "xno" ; then \
97+
cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \
98+
for fn in \
99+
pip3 \
100+
; \
101+
do \
102+
rm -f $${fn} ;\
103+
$(LN) -s $(BINDIR)/$${fn} $${fn} ;\
104+
done ;\
105+
fi
95106

96107
#
97108
# Like installunixtools, but only install links to the versioned binaries.
@@ -133,6 +144,17 @@ altinstallunixtools:
133144
$(LN) -s $(BINDIR)/$${fn} $${fn} ;\
134145
done ;\
135146
fi
147+
-if test "x$(ENSUREPIP)" != "xno" ; then \
148+
cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \
149+
for fn in \
150+
easy_install-$(VERSION) \
151+
pip$(VERSION) \
152+
; \
153+
do \
154+
rm -f $${fn} ;\
155+
$(LN) -s $(BINDIR)/$${fn} $${fn} ;\
156+
done ;\
157+
fi
136158

137159
pythonw: $(srcdir)/Tools/pythonw.c Makefile
138160
$(CC) $(LDFLAGS) -DPYTHONFRAMEWORK='"$(PYTHONFRAMEWORK)"' -o $@ \

Makefile.pre.in

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
160160
# Environment to run shared python without installed libraries
161161
RUNSHARED= @RUNSHARED@
162162

163+
# ensurepip options
164+
ENSUREPIP= @ENSUREPIP@
165+
163166
# Modes for directories, executables and data files created by the
164167
# install process. Default to user-only-writable for all file types.
165168
DIRMODE= 755
@@ -961,10 +964,30 @@ quicktest: all platform
961964
$(TESTRUNNER) $(QUICKTESTOPTS)
962965

963966

964-
install: @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
967+
install: @FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall @FRAMEWORKINSTALLLAST@
968+
if test "x$(ENSUREPIP)" != "xno" ; then \
969+
case $(ENSUREPIP) in \
970+
upgrade) ensurepip="--upgrade" ;; \
971+
install|*) ensurepip="" ;; \
972+
esac; \
973+
$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
974+
$$ensurepip --root=$(DESTDIR)/ ; \
975+
fi
976+
977+
altinstall: commoninstall
978+
if test "x$(ENSUREPIP)" != "xno" ; then \
979+
case $(ENSUREPIP) in \
980+
upgrade) ensurepip="--altinstall --upgrade" ;; \
981+
install|*) ensurepip="--altinstall" ;; \
982+
esac; \
983+
$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
984+
$$ensurepip --root=$(DESTDIR)/ ; \
985+
fi
965986

966-
altinstall: @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
967-
sharedinstall oldsharedinstall altmaninstall @FRAMEWORKALTINSTALLLAST@
987+
commoninstall: @FRAMEWORKALTINSTALLFIRST@ \
988+
altbininstall libinstall inclinstall libainstall \
989+
sharedinstall oldsharedinstall altmaninstall \
990+
@FRAMEWORKALTINSTALLLAST@
968991

969992
# Install shared libraries enabled by Setup
970993
DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
@@ -1570,7 +1593,7 @@ Python/thread.o: @THREADHEADERS@
15701593
.PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
15711594
.PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
15721595
.PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean
1573-
.PHONY: smelly funny patchcheck touch altmaninstall
1596+
.PHONY: smelly funny patchcheck touch altmaninstall commoninstall
15741597
.PHONY: gdbhooks
15751598

15761599
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY

Misc/NEWS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,12 @@ Build
363363
installed for 64-bit/32-bit universal builds. The obsolete and
364364
undocumented pythonw* symlinks are no longer installed anywhere.
365365

366+
- Issue #19553: PEP 453 - "make install" and "make altinstall" now install or
367+
upgrade pip by default, using the bundled pip provided by the new ensurepip
368+
module. A new configure option, --with-ensurepip[=upgrade|install|no], is
369+
available to override the default ensurepip "--upgrade" option. The option
370+
can also be set with "make [alt]install ENSUREPIP=[upgrade|install\no]".
371+
366372
Tools/Demos
367373
-----------
368374

configure

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ ac_includes_default="\
623623
#endif"
624624

625625
ac_subst_vars='LTLIBOBJS
626+
ENSUREPIP
626627
SRCDIRS
627628
THREADHEADERS
628629
LIBPL
@@ -815,6 +816,7 @@ with_libm
815816
with_libc
816817
enable_big_digits
817818
with_computed_gotos
819+
with_ensurepip
818820
'
819821
ac_precious_vars='build_alias
820822
host_alias
@@ -1498,6 +1500,8 @@ Optional Packages:
14981500
--with(out)-computed-gotos
14991501
Use computed gotos in evaluation loop (enabled by
15001502
default on supported compilers)
1503+
--with(out)-ensurepip=[=upgrade]
1504+
"install" or "upgrade" using bundled pip
15011505
15021506
Some influential environment variables:
15031507
MACHDEP name for machine-dependent library files
@@ -15344,6 +15348,31 @@ $as_echo "#define HAVE_IPA_PURE_CONST_BUG 1" >>confdefs.h
1534415348
esac
1534515349
fi
1534615350

15351+
# ensurepip option
15352+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ensurepip" >&5
15353+
$as_echo_n "checking for ensurepip... " >&6; }
15354+
15355+
# Check whether --with-ensurepip was given.
15356+
if test "${with_ensurepip+set}" = set; then :
15357+
withval=$with_ensurepip;
15358+
else
15359+
with_ensurepip=upgrade
15360+
fi
15361+
15362+
case $with_ensurepip in #(
15363+
yes|upgrade) :
15364+
ENSUREPIP=upgrade ;; #(
15365+
install) :
15366+
ENSUREPIP=install ;; #(
15367+
no) :
15368+
ENSUREPIP=no ;; #(
15369+
*) :
15370+
as_fn_error $? "--with-ensurepip=upgrade|install|no" "$LINENO" 5 ;;
15371+
esac
15372+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ENSUREPIP" >&5
15373+
$as_echo "$ENSUREPIP" >&6; }
15374+
15375+
1534715376
# generate output files
1534815377
ac_config_files="$ac_config_files Makefile.pre Modules/Setup.config Misc/python.pc Misc/python-config.sh"
1534915378

configure.ac

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4767,6 +4767,21 @@ if test "$have_gcc_asm_for_x87" = yes; then
47674767
esac
47684768
fi
47694769

4770+
# ensurepip option
4771+
AC_MSG_CHECKING(for ensurepip)
4772+
AC_ARG_WITH(ensurepip,
4773+
[AS_HELP_STRING([--with(out)-ensurepip=@<:@=upgrade@:>@],
4774+
["install" or "upgrade" using bundled pip])],
4775+
[],
4776+
[with_ensurepip=upgrade])
4777+
AS_CASE($with_ensurepip,
4778+
[yes|upgrade],[ENSUREPIP=upgrade],
4779+
[install],[ENSUREPIP=install],
4780+
[no],[ENSUREPIP=no],
4781+
[AC_MSG_ERROR([--with-ensurepip=upgrade|install|no])])
4782+
AC_MSG_RESULT($ENSUREPIP)
4783+
AC_SUBST(ENSUREPIP)
4784+
47704785
# generate output files
47714786
AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc Misc/python-config.sh)
47724787
AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])

0 commit comments

Comments
 (0)