Accepting request 845109 from home:mcepl:branches:devel:languages:python:Factory
- Replace ensurepip with simple script instructing to install packaged pip (bsc#1176262). - Remove bpo-31046_ensurepip_honours_prefix.patch, which is not necessary anymore. OBS-URL: https://build.opensuse.org/request/show/845109 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python38?expand=0&rev=35
This commit is contained in:
parent
b0678855e5
commit
772de6c5cd
@ -1,163 +0,0 @@
|
|||||||
From 5754521af1d51aa8e445cba07a093bbc0c88596d Mon Sep 17 00:00:00 2001
|
|
||||||
From: Zackery Spytz <zspytz@gmail.com>
|
|
||||||
Date: Mon, 16 Dec 2019 18:24:08 -0700
|
|
||||||
Subject: [PATCH] bpo-31046: ensurepip does not honour the value of $(prefix)
|
|
||||||
|
|
||||||
Co-Authored-By: Xavier de Gaye <xdegaye@gmail.com>
|
|
||||||
---
|
|
||||||
Doc/library/ensurepip.rst | 9 +++++++--
|
|
||||||
Lib/ensurepip/__init__.py | 18 +++++++++++++-----
|
|
||||||
Lib/test/test_ensurepip.py | 11 +++++++++++
|
|
||||||
Makefile.pre.in | 4 ++--
|
|
||||||
.../2019-12-16-17-50-42.bpo-31046.XA-Qfr.rst | 1 +
|
|
||||||
5 files changed, 34 insertions(+), 9 deletions(-)
|
|
||||||
create mode 100644 Misc/NEWS.d/next/Build/2019-12-16-17-50-42.bpo-31046.XA-Qfr.rst
|
|
||||||
|
|
||||||
--- a/Doc/library/ensurepip.rst
|
|
||||||
+++ b/Doc/library/ensurepip.rst
|
|
||||||
@@ -56,8 +56,9 @@ is at least as recent as the one bundled
|
|
||||||
By default, ``pip`` is installed into the current virtual environment
|
|
||||||
(if one is active) or into the system site packages (if there is no
|
|
||||||
active virtual environment). The installation location can be controlled
|
|
||||||
-through two additional command line options:
|
|
||||||
+through some additional command line options:
|
|
||||||
|
|
||||||
+* ``--prefix <dir>``: Installs ``pip`` using the given directory prefix.
|
|
||||||
* ``--root <dir>``: Installs ``pip`` relative to the given root directory
|
|
||||||
rather than the root of the currently active virtual environment (if any)
|
|
||||||
or the default root for the current Python installation.
|
|
||||||
@@ -89,7 +90,7 @@ Module API
|
|
||||||
Returns a string specifying the bundled version of pip that will be
|
|
||||||
installed when bootstrapping an environment.
|
|
||||||
|
|
||||||
-.. function:: bootstrap(root=None, upgrade=False, user=False, \
|
|
||||||
+.. function:: bootstrap(root=None, prefix=None, upgrade=False, user=False, \
|
|
||||||
altinstall=False, default_pip=False, \
|
|
||||||
verbosity=0)
|
|
||||||
|
|
||||||
@@ -99,6 +100,8 @@ Module API
|
|
||||||
If *root* is ``None``, then installation uses the default install location
|
|
||||||
for the current environment.
|
|
||||||
|
|
||||||
+ *prefix* specifies the directory prefix to use when installing.
|
|
||||||
+
|
|
||||||
*upgrade* indicates whether or not to upgrade an existing installation
|
|
||||||
of an earlier version of ``pip`` to the bundled version.
|
|
||||||
|
|
||||||
@@ -119,6 +122,8 @@ Module API
|
|
||||||
*verbosity* controls the level of output to :data:`sys.stdout` from the
|
|
||||||
bootstrapping operation.
|
|
||||||
|
|
||||||
+ .. versionchanged:: 3.9 the *prefix* parameter was added.
|
|
||||||
+
|
|
||||||
.. audit-event:: ensurepip.bootstrap root ensurepip.bootstrap
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
--- a/Lib/ensurepip/__init__.py
|
|
||||||
+++ b/Lib/ensurepip/__init__.py
|
|
||||||
@@ -56,27 +56,27 @@ def _disable_pip_configuration_settings(
|
|
||||||
os.environ['PIP_CONFIG_FILE'] = os.devnull
|
|
||||||
|
|
||||||
|
|
||||||
-def bootstrap(*, root=None, upgrade=False, user=False,
|
|
||||||
+def bootstrap(*, root=None, prefix=None, upgrade=False, user=False,
|
|
||||||
altinstall=False, default_pip=False,
|
|
||||||
verbosity=0):
|
|
||||||
"""
|
|
||||||
Bootstrap pip into the current Python installation (or the given root
|
|
||||||
- directory).
|
|
||||||
+ and directory prefix).
|
|
||||||
|
|
||||||
Note that calling this function will alter both sys.path and os.environ.
|
|
||||||
"""
|
|
||||||
# Discard the return value
|
|
||||||
- _bootstrap(root=root, upgrade=upgrade, user=user,
|
|
||||||
+ _bootstrap(root=root, prefix=prefix, upgrade=upgrade, user=user,
|
|
||||||
altinstall=altinstall, default_pip=default_pip,
|
|
||||||
verbosity=verbosity)
|
|
||||||
|
|
||||||
|
|
||||||
-def _bootstrap(*, root=None, upgrade=False, user=False,
|
|
||||||
+def _bootstrap(*, root=None, prefix=None, upgrade=False, user=False,
|
|
||||||
altinstall=False, default_pip=False,
|
|
||||||
verbosity=0):
|
|
||||||
"""
|
|
||||||
Bootstrap pip into the current Python installation (or the given root
|
|
||||||
- directory). Returns pip command status code.
|
|
||||||
+ and directory prefix). Returns pip command status code.
|
|
||||||
|
|
||||||
Note that calling this function will alter both sys.path and os.environ.
|
|
||||||
"""
|
|
||||||
@@ -119,6 +119,8 @@ def _bootstrap(*, root=None, upgrade=Fal
|
|
||||||
args = ["install", "--no-cache-dir", "--no-index", "--find-links", tmpdir]
|
|
||||||
if root:
|
|
||||||
args += ["--root", root]
|
|
||||||
+ if prefix:
|
|
||||||
+ args += ["--prefix", prefix]
|
|
||||||
if upgrade:
|
|
||||||
args += ["--upgrade"]
|
|
||||||
if user:
|
|
||||||
@@ -191,6 +193,11 @@ def _main(argv=None):
|
|
||||||
help="Install everything relative to this alternate root directory.",
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
+ "--prefix",
|
|
||||||
+ default=None,
|
|
||||||
+ help="Install everything using this prefix.",
|
|
||||||
+ )
|
|
||||||
+ parser.add_argument(
|
|
||||||
"--altinstall",
|
|
||||||
action="store_true",
|
|
||||||
default=False,
|
|
||||||
@@ -209,6 +216,7 @@ def _main(argv=None):
|
|
||||||
|
|
||||||
return _bootstrap(
|
|
||||||
root=args.root,
|
|
||||||
+ prefix=args.prefix,
|
|
||||||
upgrade=args.upgrade,
|
|
||||||
user=args.user,
|
|
||||||
verbosity=args.verbosity,
|
|
||||||
--- a/Lib/test/test_ensurepip.py
|
|
||||||
+++ b/Lib/test/test_ensurepip.py
|
|
||||||
@@ -61,6 +61,17 @@ class TestBootstrap(EnsurepipMixin, unit
|
|
||||||
unittest.mock.ANY,
|
|
||||||
)
|
|
||||||
|
|
||||||
+ def test_bootstrapping_with_prefix(self):
|
|
||||||
+ ensurepip.bootstrap(prefix="/foo/bar/")
|
|
||||||
+ self.run_pip.assert_called_once_with(
|
|
||||||
+ [
|
|
||||||
+ "install", "--no-cache-dir", "--no-index", "--find-links",
|
|
||||||
+ unittest.mock.ANY, "--prefix", "/foo/bar/",
|
|
||||||
+ "setuptools", "pip",
|
|
||||||
+ ],
|
|
||||||
+ unittest.mock.ANY,
|
|
||||||
+ )
|
|
||||||
+
|
|
||||||
def test_bootstrapping_with_user(self):
|
|
||||||
ensurepip.bootstrap(user=True)
|
|
||||||
|
|
||||||
--- a/Makefile.pre.in
|
|
||||||
+++ b/Makefile.pre.in
|
|
||||||
@@ -1188,7 +1188,7 @@ install: @FRAMEWORKINSTALLFIRST@ commoni
|
|
||||||
install|*) ensurepip="" ;; \
|
|
||||||
esac; \
|
|
||||||
$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
|
|
||||||
- $$ensurepip --root=$(DESTDIR)/ ; \
|
|
||||||
+ $$ensurepip --root=$(DESTDIR)/ --prefix=$(prefix) ; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
altinstall: commoninstall
|
|
||||||
@@ -1198,7 +1198,7 @@ altinstall: commoninstall
|
|
||||||
install|*) ensurepip="--altinstall" ;; \
|
|
||||||
esac; \
|
|
||||||
$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
|
|
||||||
- $$ensurepip --root=$(DESTDIR)/ ; \
|
|
||||||
+ $$ensurepip --root=$(DESTDIR)/ --prefix=$(prefix) ; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
commoninstall: check-clean-src @FRAMEWORKALTINSTALLFIRST@ \
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/Misc/NEWS.d/next/Build/2019-12-16-17-50-42.bpo-31046.XA-Qfr.rst
|
|
||||||
@@ -0,0 +1 @@
|
|
||||||
+A directory prefix can now be specified when using :mod:`ensurepip`.
|
|
@ -1,3 +1,11 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Oct 30 17:49:32 CET 2020 - Matej Cepl <mcepl@suse.com>
|
||||||
|
|
||||||
|
- Replace ensurepip with simple script instructing to install
|
||||||
|
packaged pip (bsc#1176262).
|
||||||
|
- Remove bpo-31046_ensurepip_honours_prefix.patch, which is not
|
||||||
|
necessary anymore.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Oct 9 16:05:50 UTC 2020 - Dominique Leuenberger <dimstar@opensuse.org>
|
Fri Oct 9 16:05:50 UTC 2020 - Dominique Leuenberger <dimstar@opensuse.org>
|
||||||
|
|
||||||
|
@ -146,9 +146,6 @@ Patch27: CVE-2019-5010-null-defer-x509-cert-DOS.patch
|
|||||||
# PATCH-FIX-UPSTREAM bpo36302-sort-module-sources.patch bsc#1041090 bwiedemann@suse.com
|
# PATCH-FIX-UPSTREAM bpo36302-sort-module-sources.patch bsc#1041090 bwiedemann@suse.com
|
||||||
# Sort list of sources to have stable order in the compiled .so library.
|
# Sort list of sources to have stable order in the compiled .so library.
|
||||||
Patch28: bpo36302-sort-module-sources.patch
|
Patch28: bpo36302-sort-module-sources.patch
|
||||||
# PATCH-FEATURE-UPSTREAM bpo-31046_ensurepip_honours_prefix.patch bpo#31046 mcepl@suse.com
|
|
||||||
# ensurepip should honour the value of $(prefix)
|
|
||||||
Patch29: bpo-31046_ensurepip_honours_prefix.patch
|
|
||||||
# PATCH-FIX-UPSTREAM bsc1167501-invalid-alignment.patch gh#python/cpython#19133 mcepl@suse.com
|
# PATCH-FIX-UPSTREAM bsc1167501-invalid-alignment.patch gh#python/cpython#19133 mcepl@suse.com
|
||||||
# Fix wrong misalignment of pointer to vectorcallfunc
|
# Fix wrong misalignment of pointer to vectorcallfunc
|
||||||
Patch31: bsc1167501-invalid-alignment.patch
|
Patch31: bsc1167501-invalid-alignment.patch
|
||||||
@ -288,7 +285,6 @@ Summary: Python 3 Interpreter and Stdlib Core
|
|||||||
Requires: libpython%{so_version} = %{version}
|
Requires: libpython%{so_version} = %{version}
|
||||||
Requires: python-rpm-macros
|
Requires: python-rpm-macros
|
||||||
Recommends: %{python_pkg_name} = %{version}
|
Recommends: %{python_pkg_name} = %{version}
|
||||||
#Recommends: python3-ensurepip
|
|
||||||
# python 3.1 didn't have a separate python-base, so it is wrongly
|
# python 3.1 didn't have a separate python-base, so it is wrongly
|
||||||
# not a conflict to have python3-3.1 and python3-base > 3.1
|
# not a conflict to have python3-3.1 and python3-base > 3.1
|
||||||
Obsoletes: python3 < 3.2
|
Obsoletes: python3 < 3.2
|
||||||
@ -412,7 +408,6 @@ other applications.
|
|||||||
%patch25 -p1
|
%patch25 -p1
|
||||||
%patch27 -p1
|
%patch27 -p1
|
||||||
%patch28 -p1
|
%patch28 -p1
|
||||||
%patch29 -p1
|
|
||||||
%patch31 -p1
|
%patch31 -p1
|
||||||
|
|
||||||
# drop Autoconf version requirement
|
# drop Autoconf version requirement
|
||||||
@ -649,6 +644,17 @@ rm -fv %{buildroot}%{dynlib nis}
|
|||||||
# overwrite the copied binary with a link
|
# overwrite the copied binary with a link
|
||||||
ln -sf python%{python_version} %{buildroot}%{_bindir}/python3
|
ln -sf python%{python_version} %{buildroot}%{_bindir}/python3
|
||||||
|
|
||||||
|
# remove ensurepip (bsc#1176262)
|
||||||
|
rm -rf %{buildroot}/%{sitedir}/ensurepip*
|
||||||
|
cat > %{buildroot}/%{sitedir}/ensurepip.py <<EOF
|
||||||
|
#!/usr/bin/python3
|
||||||
|
import sys
|
||||||
|
|
||||||
|
print("Install the package python3-pip and run pip directly.",
|
||||||
|
file=sys.stderr)
|
||||||
|
sys.exit(255)
|
||||||
|
EOF
|
||||||
|
|
||||||
# decide to ship python3 or just python3.X
|
# decide to ship python3 or just python3.X
|
||||||
%if !%{primary_interpreter}
|
%if !%{primary_interpreter}
|
||||||
# base
|
# base
|
||||||
@ -940,7 +946,6 @@ echo %{sitedir}/_import_failed > %{buildroot}/%{sitedir}/site-packages/zzzz-impo
|
|||||||
%{sitedir}/distutils
|
%{sitedir}/distutils
|
||||||
%{sitedir}/email
|
%{sitedir}/email
|
||||||
%{sitedir}/encodings
|
%{sitedir}/encodings
|
||||||
%{sitedir}/ensurepip
|
|
||||||
%{sitedir}/html
|
%{sitedir}/html
|
||||||
%{sitedir}/http
|
%{sitedir}/http
|
||||||
%{sitedir}/importlib
|
%{sitedir}/importlib
|
||||||
|
Loading…
x
Reference in New Issue
Block a user