]> granicus.if.org Git - python/commitdiff
Issue 22878: PEP 477 - "make install" and "make altinstall" integration
authorNed Deily <nad@acm.org>
Thu, 20 Nov 2014 10:11:03 +0000 (02:11 -0800)
committerNed Deily <nad@acm.org>
Thu, 20 Nov 2014 10:11:03 +0000 (02:11 -0800)
The backport of ensurepip to 2.7.9 allows pip to optionally be installed
or upgraded using the bundled pip provided by the new ensurepip module.
The option can be specified persistently using the configure option:

    ./configure --with-ensurepip[=upgrade|install|no]

It can also be overridden on either the "install" or "altinstall" targets:

    make [alt]install ENSUREPIP=[upgrade|install|no]

For Python 2, the default option is "no" (do not install pip).

Doc/using/unix.rst
Doc/whatsnew/2.7.rst
Mac/Makefile.in
Makefile.pre.in
Misc/NEWS
configure
configure.ac

index b3e6ceda61a7feded19120540aad320724a409bb..da4b743726e8295a77362d62ad8835800314c789 100644 (file)
@@ -59,6 +59,8 @@ You can get Python from `OpenCSW <http://www.opencsw.org/>`_.  Various versions
 of Python are available and can be installed with e.g. ``pkgutil -i python27``.
 
 
+.. _building-python-on-unix:
+
 Building Python
 ===============
 
index 4c86f3e76c07278c699849a9cb86b50c7dbd1bb5..9b02687378fe7eff7e61891977d7555f47d662b6 100644 (file)
@@ -2605,6 +2605,11 @@ By default, the commands ``pip``, ``pipX`` and ``pipX.Y`` will be installed on
 all platforms (where X.Y stands for the version of the Python installation),
 along with the ``pip`` Python package and its dependencies.
 
+For CPython :ref:`source builds on POSIX systems <building-python-on-unix>`,
+the ``make install`` and ``make altinstall`` commands do not bootstrap ``pip``
+by default.  This behaviour can be controlled through configure options, and
+overridden through Makefile options.
+
 On Windows and Mac OS X, the CPython installers now default to installing
 ``pip`` along with CPython itself (users may opt out of installing it
 during the installation process). Window users will need to opt in to the
index a3e00b22f91cd210f07a18af73bf77e6448a798f..1b9a41f466dc62c64e80e74d6fd2f99989b6a52d 100644 (file)
@@ -3,9 +3,11 @@
 # commandline in that case.
 
 VERSION=@VERSION@
+ENSUREPIP=@ENSUREPIP@
 builddir = ..
 srcdir=@srcdir@
 prefix=@prefix@
+exec_prefix=@exec_prefix@
 LIBDEST=$(prefix)/lib/python$(VERSION)
 RUNSHARED=@RUNSHARED@
 BUILDEXE=@BUILDEXEEXT@
@@ -21,7 +23,7 @@ MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
 export MACOSX_DEPLOYMENT_TARGET
 
 # These are normally glimpsed from the previous set
-bindir=$(prefix)/bin
+BINDIR=                @bindir@
 PYTHONAPPSDIR=@FRAMEWORKINSTALLAPPSPREFIX@/$(PYTHONFRAMEWORK) $(VERSION)
 APPINSTALLDIR=$(prefix)/Resources/Python.app
 
@@ -92,6 +94,18 @@ ifneq ($(LIPO_32BIT_FLAGS),)
                ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
        done
 endif
+       -if test "x$(ENSUREPIP)" != "xno"  ; then \
+               cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \
+               for fn in \
+                               easy_install \
+                               pip \
+                               pip2 \
+                               ; \
+               do \
+                       rm -f $${fn} ;\
+                       $(LN) -s $(BINDIR)/$${fn} $${fn} ;\
+               done ;\
+       fi
 
 
 #
@@ -112,7 +126,18 @@ ifneq ($(LIPO_32BIT_FLAGS),)
                ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
        done
 endif
-       ln -fs "$(prefix)/bin/2to3-$(VERSION)" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/2to3-$(VERSION)" ;\
+       ln -fs "$(prefix)/bin/2to3-$(VERSION)" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/2to3-$(VERSION)"
+       -if test "x$(ENSUREPIP)" != "xno"  ; then \
+               cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \
+               for fn in \
+                               easy_install-$(VERSION) \
+                               pip$(VERSION) \
+                               ; \
+               do \
+                       rm -f $${fn} ;\
+                       $(LN) -s $(BINDIR)/$${fn} $${fn} ;\
+               done ;\
+       fi
 
 # By default most tools are installed without a version in their basename, to
 # make it easier to install (and use) several python versions side-by-side move
index efa3b51830e8fa08199a0d9cf40d4fd5b1985df7..7f4ec2f55e7f08a99a89158719bf0cd9d46f647d 100644 (file)
@@ -144,6 +144,9 @@ OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
 # Environment to run shared python without installed libraries
 RUNSHARED=       @RUNSHARED@
 
+# ensurepip options
+ENSUREPIP=      @ENSUREPIP@
+
 # Modes for directories, executables and data files created by the
 # install process.  Default to user-only-writable for all file types.
 DIRMODE=       755
@@ -829,12 +832,31 @@ memtest:  all platform
                $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
 
 # Install everything
-install:       @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
+install:       @FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall @FRAMEWORKINSTALLLAST@
+       if test "x$(ENSUREPIP)" != "xno"  ; then \
+               case $(ENSUREPIP) in \
+                       upgrade) ensurepip="--upgrade" ;; \
+                       install|*) ensurepip="" ;; \
+               esac; \
+               $(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
+                       $$ensurepip --root=$(DESTDIR)/ ; \
+       fi
 
 # Install almost everything without disturbing previous versions
-altinstall:    @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall \
-                               libainstall altmaninstall \
-                sharedinstall oldsharedinstall @FRAMEWORKALTINSTALLLAST@
+altinstall:    commoninstall
+       if test "x$(ENSUREPIP)" != "xno"  ; then \
+               case $(ENSUREPIP) in \
+                       upgrade) ensurepip="--altinstall --upgrade --no-default-pip" ;; \
+                       install|*) ensurepip="--altinstall --no-default-pip" ;; \
+               esac; \
+               $(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
+                       $$ensurepip --root=$(DESTDIR)/ ; \
+       fi
+
+commoninstall: @FRAMEWORKALTINSTALLFIRST@ \
+               altbininstall libinstall inclinstall libainstall \
+               sharedinstall oldsharedinstall altmaninstall \
+               @FRAMEWORKALTINSTALLLAST@
 
 # Install shared libraries enabled by Setup
 DESTDIRS=      $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
@@ -1371,7 +1393,7 @@ Python/thread.o: @THREADHEADERS@
 .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
 .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
 .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean
-.PHONY: smelly funny patchcheck touch altmaninstall
+.PHONY: smelly funny patchcheck touch altmaninstall commoninstall
 .PHONY: gdbhooks
 
 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY
index aed73d065bfd72d11fd4545673fe6f130dc7e2da..5ecfd20a058363f27d5e7f55cdb0b2e75476acaa 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -326,6 +326,13 @@ Build
 
 - Issue #22877: PEP 477 - OS X installer now installs pip.
 
+- Issue #22878: PEP 477 - "make install" and "make altinstall" can now install
+  or upgrade pip, using the bundled pip provided by the backported ensurepip
+  module.  A configure option, --with-ensurepip[=upgrade|install|no], is
+  available to set the option for subsequent installs; the default for Python 2
+  in "no" (do not install or upgrade pip).  The option can also be set with
+  "make [alt]install ENSUREPIP=[upgrade|install|no]".
+
 Windows
 -------
 
index 4a698f352a9d2ff3f66f64f7fbc4926c8dd44c4f..68033f50d775e176c1c3072cab4414f6f91d3030 100755 (executable)
--- a/configure
+++ b/configure
@@ -624,6 +624,7 @@ ac_includes_default="\
 #endif"
 
 ac_subst_vars='LTLIBOBJS
+ENSUREPIP
 SRCDIRS
 THREADHEADERS
 UNICODE_OBJS
@@ -807,6 +808,7 @@ with_libm
 with_libc
 enable_big_digits
 enable_unicode
+with_ensurepip
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1486,6 +1488,9 @@ Optional Packages:
   --with-fpectl           enable SIGFPE catching
   --with-libm=STRING      math library
   --with-libc=STRING      C library
+  --with(out)-ensurepip=[=OPTION]
+                          "install" or "upgrade" using bundled pip, default is
+                          "no"
 
 Some influential environment variables:
   CC          C compiler command
@@ -14604,6 +14609,31 @@ done
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
 $as_echo "done" >&6; }
 
+# ensurepip option
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ensurepip" >&5
+$as_echo_n "checking for ensurepip... " >&6; }
+
+# Check whether --with-ensurepip was given.
+if test "${with_ensurepip+set}" = set; then :
+  withval=$with_ensurepip;
+else
+  with_ensurepip=no
+fi
+
+case $with_ensurepip in #(
+  yes|upgrade) :
+    ENSUREPIP=upgrade ;; #(
+  install) :
+    ENSUREPIP=install ;; #(
+  no) :
+    ENSUREPIP=no ;; #(
+  *) :
+    as_fn_error $? "--with-ensurepip=upgrade|install|no" "$LINENO" 5 ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ENSUREPIP" >&5
+$as_echo "$ENSUREPIP" >&6; }
+
+
 # generate output files
 ac_config_files="$ac_config_files Makefile.pre Modules/Setup.config Misc/python.pc"
 
index 16da9f39996b24d8fba3d7162317fb14a9f98f23..94a215e0cf074123da21b3540beb95d223cfa75d 100644 (file)
@@ -4552,6 +4552,21 @@ for dir in $SRCDIRS; do
 done
 AC_MSG_RESULT(done)
 
+# ensurepip option
+AC_MSG_CHECKING(for ensurepip)
+AC_ARG_WITH(ensurepip,
+    [AS_HELP_STRING([--with(out)-ensurepip=@<:@=OPTION@:>@],
+        ["install" or "upgrade" using bundled pip, default is "no"])],
+    [],
+    [with_ensurepip=no])
+AS_CASE($with_ensurepip,
+    [yes|upgrade],[ENSUREPIP=upgrade],
+    [install],[ENSUREPIP=install],
+    [no],[ENSUREPIP=no],
+    [AC_MSG_ERROR([--with-ensurepip=upgrade|install|no])])
+AC_MSG_RESULT($ENSUREPIP)
+AC_SUBST(ENSUREPIP)
+
 # generate output files
 AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
 AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])