Compare commits

...

23 Commits
f32 ... master

Author SHA1 Message Date
Lumir Balhar 728b4e49d0 Do not emit a warning about root privileges when --root is used 2020-07-10 08:17:12 +02:00
Miro Hrončok 21fe0a233c Backport: Update tests to be endian safe, fix FTBFS on s390x
Also, use %autopatch to apply the patches.
2020-07-08 17:52:45 +02:00
Miro Hrončok 159feb818e Cleanup explicit conflicts with old RPM macros 2020-07-08 15:45:17 +02:00
Miro Hrončok e195c51818 Switch to %pytest to simplify the spec file
/usr/bin/pip is Python 3 now anyway, so we can drop the custom _bin hack.
2020-07-08 15:45:17 +02:00
Miro Hrončok 8253bfab57 Update bundled provides to match 20.1.1 and verify it in %check 2020-07-08 15:45:17 +02:00
Lumir Balhar acf982e208 Deselect tests incompatible with the latest virtualenv 2020-06-17 07:41:13 +02:00
Miro Hrončok 230ac9caa8 Rebuilt for Python 3.9 2020-05-24 03:30:08 +02:00
Miro Hrončok 97bba91589 Bootstrap for Python 3.9 2020-05-22 00:30:49 +02:00
Tomas Hrnciar 5ef43e57f4 Update to 20.1.1 2020-05-20 08:15:36 +00:00
Tomas Hrnciar 0e2a444500 Update to 20.1 2020-05-20 08:15:36 +00:00
Tomas Hrnciar 55406531cf Update to 20.1~b1
Don't install pip wheel via path to prevent PEP 610 treatment, see:
https://discuss.python.org/t/pep-610-usage-guidelines-for-linux-distributions/4012
2020-05-20 08:15:36 +00:00
Miro Hrončok e858da1425 Fedora CI: Add Python 3.9 2020-04-27 17:10:03 +02:00
Miro Hrončok 9d1451298e Only recommend setuptools, don't require them 2020-04-15 12:38:11 +02:00
Tomas Hrnciar 46e383d546 Remove doctree pickles
This commit removes hidden doctree folder which serves as a cache for
Sphinx when documentation is build. It's useless for user and creates
rpmlint warning hidden-file-or-dir.
2020-04-15 11:09:16 +02:00
Tomas Hrnciar db4c30e311 Remove python_provide macro
This commit removes %python_provide macro which is now automatic, see:
https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/message/SSJLPWSGFGPYRSHXQZDR7JNQXSDGGX3Z/
This is applicable only for F33 and higher.
2020-04-15 11:09:16 +02:00
Tomas Hrnciar f6c63603fb Replace pypi source with tarball from GitHub
Pypi source does not include tests folder so they had to be manually
downloaded from GitHub. This commit replaces pypi source with tarball
from GitHub where tests are included.
This also fixes rpmlint invalid-url warning.
2020-04-15 11:09:11 +02:00
Tomas Hrnciar 903b01b22d Add rpmlint config to filter not important warnings and errors
This commit adds rpmlint config to filter warning and errors
that are not really a problem. Such as no-documentation warning
for python-pip-wheel which has documentation README shipped with main
package but rpmlint does not see it.
Then it filters out venv spelling error and adds temporary filter for
non-executable-script and wrong-script-interpreter those will be fixed
once all upstream PRs will be merged.
2020-04-14 16:15:29 +02:00
Tomas Hrnciar 542eb0faf8 Link to man page for all executables
There are four different executables for python-pip, but so far only two of
them had man page. This commit makes man page available for rest of the
executables via links.
2020-04-14 16:15:20 +02:00
Miro Hrončok 4347c1397d Allow setting $TMPDIR to $PWD/... during pip wheel
Needed for https://bugzilla.redhat.com/show_bug.cgi?id=1806625
2020-04-10 15:30:03 +02:00
Miro Hrončok 7913cd9edf Make patches apply --without tests
Some patches touch tests and we didn't include the test sources --without tests,
leading to broken build. This was a long standing reoccurring problem.

Now we always include and unpack tests sources, even when we don't run them.
2020-04-06 13:24:41 +02:00
Miro Hrončok eb1cbbd764 Don't warn the user about pip._internal.main() entrypoint to fix ensurepip 2020-03-10 12:22:59 +01:00
Miro Hrončok abb97d98f6 Fedora CI: Run %pyproject macros integration tests 2020-03-06 11:40:32 +01:00
Miro Hrončok f994ff1cc7 Update to 20.0.2
Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1793456

The main() wrapper moved the import path again, this time with compatibility shim:

 - we still need pip-allow-different-versions.patch to support older pips installed by users
 - we dropped callable-main.patch - the shim is provided by pip for all previous paths
 - no need to patch older pips to support user installed pip 20+
 - no need to patch Pythons (or virtualenv) to support pip 20+ wheel in ensurepip
2020-03-04 12:47:38 +01:00
13 changed files with 413 additions and 1292 deletions

49
.gitignore vendored
View File

@ -1,42 +1,7 @@
pip-0.7.2.tar.gz
/pip-0.8.tar.gz
/pip-0.8.2.tar.gz
/pip-0.8.3.tar.gz
/pip-1.0.2.tar.gz
/pip-1.1.tar.gz
/pip-1.3.1.tar.gz
/pip-1.4.1.tar.gz
/pip-1.5.4.tar.gz
/pip-1.5.6.tar.gz
/pip-1.5.6-tests.tar.gz
/pip-6.0.8.tar.gz
/pip-7.0.3.tar.gz
/pip-7.1.0.tar.gz
/pip-7.1.0-tests.tar.gz
/pip-8.0.2.tar.gz
/pip-8.1.2.tar.gz
/pip-8.1.2-tests.tar.gz
/pip-9.0.1.tar.gz
/pip-9.0.1-tests.tar.gz
/pip-9.0.3.tar.gz
/pip-9.0.3-tests.tar.gz
/pip-10.0.1.tar.gz
/pip-18.0.tar.gz
/d2e63fbfc62af3b7050f619b2f5bb8658985b931.zip
/2018.2.tar.gz
/pip-18.0-tests.tar.gz
/d2e63fbfc62af3b7050f619b2f5bb8658985b931.tar.gz
/pip-18.1.tar.gz
/pip-18.1-tests.tar.gz
/pip-19.0.2.tar.gz
/pip-19.0.2-tests.tar.gz
/pip-19.0.3.tar.gz
/pip-19.0.3-tests.tar.gz
/pip-19.1.tar.gz
/pip-19.1-tests.tar.gz
/pip-19.1.1.tar.gz
/pip-19.1.1-tests.tar.gz
/pip-19.2.3.tar.gz
/pip-19.2.3-tests.tar.gz
/pip-19.3.1.tar.gz
/pip-19.3.1-tests.tar.gz
/*.tar.gz
/*.zip
/pip-*/
/pip/
/results_python-pip/
*.rpm

75
b30dd1e04e.patch Normal file
View File

@ -0,0 +1,75 @@
From b30dd1e04e1f37901733f1be0a5a1e02c466ad0c Mon Sep 17 00:00:00 2001
From: gutsytechster <prashantsharma161198@gmail.com>
Date: Wed, 15 Apr 2020 19:54:48 +0530
Subject: [PATCH] fix(tests/unit): Update tests to be endian safe
This updates `test_path_to_display` and `test_str_to_display__encoding`
to use the endian safe expected result instead of the hardcoded one.
This fixes https://github.com/pypa/pip/issues/7921
---
tests/unit/test_compat.py | 8 +++++++-
tests/unit/test_utils.py | 16 +++++++++++++---
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/tests/unit/test_compat.py b/tests/unit/test_compat.py
index 1f31bc5ce8..b13087a1dd 100644
--- a/tests/unit/test_compat.py
+++ b/tests/unit/test_compat.py
@@ -2,6 +2,7 @@
import locale
import os
+import sys
import pytest
@@ -91,8 +92,13 @@ def test_str_to_display__decode_error(monkeypatch, caplog):
# Encode with an incompatible encoding.
data = u'ab'.encode('utf-16')
actual = str_to_display(data)
+ # Keep the expected value endian safe
+ if sys.byteorder == "little":
+ expected = "\\xff\\xfea\x00b\x00"
+ elif sys.byteorder == "big":
+ expected = "\\xfe\\xff\x00a\x00b"
- assert actual == u'\\xff\\xfea\x00b\x00', (
+ assert actual == expected, (
# Show the encoding for easier troubleshooting.
'encoding: {!r}'.format(locale.getpreferredencoding())
)
diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py
index 7d74a66498..ebabd29e26 100644
--- a/tests/unit/test_utils.py
+++ b/tests/unit/test_utils.py
@@ -375,6 +375,18 @@ def test_rmtree_retries_for_3sec(tmpdir, monkeypatch):
rmtree('foo')
+if sys.byteorder == "little":
+ expected_byte_string = (
+ u"b'\\xff\\xfe/\\x00p\\x00a\\x00t\\x00h\\x00/"
+ "\\x00d\\x00\\xe9\\x00f\\x00'"
+ )
+elif sys.byteorder == "big":
+ expected_byte_string = (
+ u"b'\\xfe\\xff\\x00/\\x00p\\x00a\\x00t\\x00h\\"
+ "x00/\\x00d\\x00\\xe9\\x00f'"
+ )
+
+
@pytest.mark.parametrize('path, fs_encoding, expected', [
(None, None, None),
# Test passing a text (unicode) string.
@@ -383,9 +395,7 @@ def test_rmtree_retries_for_3sec(tmpdir, monkeypatch):
(u'/path/déf'.encode('utf-8'), 'utf-8', u'/path/déf'),
# Test a bytes object with a character that can't be decoded.
(u'/path/déf'.encode('utf-8'), 'ascii', u"b'/path/d\\xc3\\xa9f'"),
- (u'/path/déf'.encode('utf-16'), 'utf-8',
- u"b'\\xff\\xfe/\\x00p\\x00a\\x00t\\x00h\\x00/"
- "\\x00d\\x00\\xe9\\x00f\\x00'"),
+ (u'/path/déf'.encode('utf-16'), 'utf-8', expected_byte_string),
])
def test_path_to_display(monkeypatch, path, fs_encoding, expected):
monkeypatch.setattr(sys, 'getfilesystemencoding', lambda: fs_encoding)

View File

@ -1,43 +0,0 @@
diff --git a/src/pip/_internal/__init__.py b/src/pip/_internal/__init__.py
index 8c0e4c58..76e280e5 100755
--- a/src/pip/_internal/__init__.py
+++ b/src/pip/_internal/__init__.py
@@ -1,2 +1,3 @@
#!/usr/bin/env python
import pip._internal.utils.inject_securetransport # noqa
+from pip._internal import main # noqa
diff --git a/src/pip/_internal/main.py b/src/pip/_internal/main.py
index 1e922402..d3df58b3 100644
--- a/src/pip/_internal/main.py
+++ b/src/pip/_internal/main.py
@@ -45,3 +45,30 @@ def main(args=None):
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
return command.main(cmd_args)
+
+
+# Dark magic to make the main module itself callable.
+# This is needed to be able to use this pip in ensurepip of older Pythons
+# without patching all the Pythons.
+
+# In Python 3.5+, we can just inherit, define __call__ and override
+# sys.modules[__name__].__class__, however, that is not possible in 2.7.
+
+class _CallableModule(type(sys.modules[__name__])):
+ def __init__(self):
+ super(_CallableModule, self).__init__(__name__)
+ self._main = sys.modules[__name__]
+ sys.modules[__name__] = self
+ self.__doc__ = self._main.__doc__
+
+ def __call__(self, *args, **kwargs):
+ return main(*args, **kwargs)
+
+ def __dir__(self):
+ return dir(self._main)
+
+ def __getattr__(self, attr):
+ return getattr(self._main, attr)
+
+
+_CallableModule()

View File

@ -1,12 +1,27 @@
From 09bf87d33141a5c06a1d410839d162262baa16c4 Mon Sep 17 00:00:00 2001
From: Tomas Hrnciar <thrnciar@redhat.com>
Date: Sun, 26 Apr 2020 21:38:44 +0200
Subject: [PATCH] Dummy certifi patch
---
src/pip/_vendor/certifi/core.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/pip/_vendor/certifi/core.py b/src/pip/_vendor/certifi/core.py
index 7271acf..9f0dc20 100644
index 56b52a3c..e99043f0 100644
--- a/src/pip/_vendor/certifi/core.py
+++ b/src/pip/_vendor/certifi/core.py
@@ -10,6 +10,4 @@ import os
@@ -21,9 +21,7 @@ except ImportError:
def where():
- f = os.path.dirname(__file__)
-
- return os.path.join(f, 'cacert.pem')
- return os.path.join(f, "cacert.pem")
+ return '/etc/pki/tls/certs/ca-bundle.crt'
def contents():
--
2.23.0

View File

@ -1,6 +1,6 @@
From aab24967a03bda3b0999d80562a6064c27d1e0e0 Mon Sep 17 00:00:00 2001
From: Tomas Orsava <torsava@redhat.com>
Date: Tue, 12 Nov 2019 17:15:08 +0100
From 74bb5d26e232493de43adfa1f4b42b66fd701294 Mon Sep 17 00:00:00 2001
From: Tomas Hrnciar <thrnciar@redhat.com>
Date: Sun, 26 Apr 2020 13:52:24 +0200
Subject: [PATCH] Downstream only patch
Emit a warning to the user if pip install is run with root privileges
@ -10,21 +10,21 @@ Issue upstream: https://github.com/pypa/pip/issues/4288
1 file changed, 19 insertions(+)
diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py
index 5842d18..a6104b4 100644
index 70bda2e2..1e750ae1 100644
--- a/src/pip/_internal/commands/install.py
+++ b/src/pip/_internal/commands/install.py
@@ -12,6 +12,8 @@ import logging
import operator
@@ -13,6 +13,8 @@ import operator
import os
import shutil
import site
+import sys
+from os import path
from optparse import SUPPRESS_HELP
from pip._vendor import pkg_resources
@@ -281,6 +283,23 @@ class InstallCommand(RequirementCommand):
def run(self, options, args):
# type: (Values, List[Any]) -> int
@@ -241,6 +243,23 @@ class InstallCommand(RequirementCommand):
raise CommandError("Can not combine '--user' and '--target'")
cmdoptions.check_install_build_global(options)
+
+ def is_venv():
@ -33,7 +33,7 @@ index 5842d18..a6104b4 100644
+ sys.base_prefix != sys.prefix))
+
+ # Check whether we have root privileges and aren't in venv/virtualenv
+ if os.getuid() == 0 and not is_venv():
+ if os.getuid() == 0 and not is_venv() and not options.root_path:
+ command = path.basename(sys.argv[0])
+ if command == "__main__.py":
+ command = path.basename(sys.executable) + " -m pip"
@ -47,5 +47,5 @@ index 5842d18..a6104b4 100644
if options.upgrade:
upgrade_strategy = options.upgrade_strategy
--
2.20.1
2.23.0

View File

@ -0,0 +1,72 @@
From 7c36cb21910b415e0eb171d0f6c4dbf72382fdaf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Tue, 10 Mar 2020 11:03:22 +0100
Subject: [PATCH] Don't warn the user about pip._internal.main() entrypoint
In Fedora, we use that in ensurepip and users cannot do anything about it,
this warning is juts moot. Also, the warning breaks CPython test suite.
---
src/pip/_internal/__init__.py | 2 +-
src/pip/_internal/utils/entrypoints.py | 19 ++++++++++---------
tests/functional/test_cli.py | 3 ++-
3 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/src/pip/_internal/__init__.py b/src/pip/_internal/__init__.py
index 3aa8a46..0ec017b 100755
--- a/src/pip/_internal/__init__.py
+++ b/src/pip/_internal/__init__.py
@@ -15,4 +15,4 @@ def main(args=None):
"""
from pip._internal.utils.entrypoints import _wrapper
- return _wrapper(args)
+ return _wrapper(args, _nowarn=True)
diff --git a/src/pip/_internal/utils/entrypoints.py b/src/pip/_internal/utils/entrypoints.py
index befd01c..d6f3632 100644
--- a/src/pip/_internal/utils/entrypoints.py
+++ b/src/pip/_internal/utils/entrypoints.py
@@ -7,7 +7,7 @@ if MYPY_CHECK_RUNNING:
from typing import Optional, List
-def _wrapper(args=None):
+def _wrapper(args=None, _nowarn=False):
# type: (Optional[List[str]]) -> int
"""Central wrapper for all old entrypoints.
@@ -20,12 +20,13 @@ def _wrapper(args=None):
directing them to an appropriate place for help, we now define all of
our old entrypoints as wrappers for the current one.
"""
- sys.stderr.write(
- "WARNING: pip is being invoked by an old script wrapper. This will "
- "fail in a future version of pip.\n"
- "Please see https://github.com/pypa/pip/issues/5599 for advice on "
- "fixing the underlying issue.\n"
- "To avoid this problem you can invoke Python with '-m pip' instead of "
- "running pip directly.\n"
- )
+ if not _nowarn:
+ sys.stderr.write(
+ "WARNING: pip is being invoked by an old script wrapper. This will "
+ "fail in a future version of pip.\n"
+ "Please see https://github.com/pypa/pip/issues/5599 for advice on "
+ "fixing the underlying issue.\n"
+ "To avoid this problem you can invoke Python with '-m pip' instead of "
+ "running pip directly.\n"
+ )
return main(args)
diff --git a/tests/functional/test_cli.py b/tests/functional/test_cli.py
index e416315..7f57f67 100644
--- a/tests/functional/test_cli.py
+++ b/tests/functional/test_cli.py
@@ -31,4 +31,5 @@ def test_entrypoints_work(entrypoint, script):
result = script.pip("-V")
result2 = script.run("fake_pip", "-V", allow_stderr_warning=True)
assert result.stdout == result2.stdout
- assert "old script wrapper" in result2.stderr
+ if entrypoint[0] != "fake_pip = pip._internal:main":
+ assert "old script wrapper" in result2.stderr
--
2.24.1

View File

@ -1,22 +1,26 @@
--- /usr/bin/pip3 2019-11-12 17:37:34.793131862 +0100
+++ pip3 2019-11-12 17:40:42.014107134 +0100
@@ -2,7 +2,19 @@
@@ -2,7 +2,23 @@
# -*- coding: utf-8 -*-
import re
import sys
-from pip._internal.main import main
-from pip._internal.cli.main import main
+
+try:
+ from pip._internal.main import main
+ from pip._internal.cli.main import main
+except ImportError:
+ try:
+ # If the user has downgraded pip, the above import will fail.
+ # Let's try older methods of invoking it:
+
+ # pip 19 uses this
+ from pip._internal import main
+ from pip._internal.main import main
+ except ImportError:
+ # older pip versions use this
+ from pip import main
+ try:
+ # If the user has downgraded pip, the above import will fail.
+ # Let's try older methods of invoking it:
+
+ # pip 19 uses this
+ from pip._internal import main
+ except ImportError:
+ # older pip versions use this
+ from pip import main
+
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])

15
python-pip.rpmlintrc Normal file
View File

@ -0,0 +1,15 @@
# This is just temporary, when upstream merges PRs it can be removed
# https://github.com/pypa/pip/pull/7959
# https://github.com/ActiveState/appdirs/pull/144
# https://github.com/psf/requests/pull/5410
# https://github.com/chardet/chardet/pull/192
addFilter(r'(non-executable-script|wrong-script-interpreter) .+/pip/_internal/__init__.py\b')
addFilter(r'(non-executable-script|wrong-script-interpreter) .+/pip/_vendor/appdirs.py\b')
addFilter(r'(non-executable-script|wrong-script-interpreter) .+/pip/_vendor/requests/certs.py\b')
addFilter(r'(non-executable-script|wrong-script-interpreter) .+/pip/_vendor/chardet/cli/chardetect.py\b')
# We ship README with the main package but not with the wheel
addFilter(r'python-pip-wheel.noarch: W: no-documentation')
# SPELLING ERRORS
addFilter(r'W: spelling-error .* venv')

View File

@ -3,7 +3,9 @@
%bcond_without doc
%global srcname pip
%global python_wheelname %{srcname}-%{version}-py2.py3-none-any.whl
%global base_version 20.1.1
%global upstream_version %{base_version}%{?prerel}
%global python_wheelname %{srcname}-%{upstream_version}-py2.py3-none-any.whl
%global python_wheeldir %{_datadir}/python-wheels
%if %{with doc}
@ -15,8 +17,8 @@
Name: python-%{srcname}
# When updating, update the bundled libraries versions bellow!
# You can use vendor_meta.sh in the dist git repo
Version: 19.3.1
Release: 2%{?dist}
Version: %{base_version}%{?prerel:~%{prerel}}
Release: 6%{?dist}
Summary: A tool for installing and managing Python packages
# We bundle a lot of libraries with pip, which itself is under MIT license.
@ -47,8 +49,8 @@ Summary: A tool for installing and managing Python packages
# webencodings: BSD
License: MIT and Python and ASL 2.0 and BSD and ISC and LGPLv2 and MPLv2.0 and (ASL 2.0 or BSD)
URL: http://www.pip-installer.org
Source0: %pypi_source
URL: https://pip.pypa.io/
Source0: https://github.com/pypa/pip/archive/%{upstream_version}/%{srcname}-%{upstream_version}.tar.gz
BuildArch: noarch
@ -60,18 +62,10 @@ BuildRequires: python-setuptools-wheel
BuildRequires: python-wheel-wheel
%endif
# to get tests:
# git clone https://github.com/pypa/pip && cd pip
# VERSION= # define the version you want
# git checkout $VERSION && tar -czvf ../pip-$VERSION-tests.tar.gz tests/
%if %{with tests}
Source1: pip-%{version}-tests.tar.gz
%endif
# Themes required to build the docs.
%if %{with doc}
Source2: https://github.com/pypa/pypa-docs-theme/archive/%{pypa_theme_commit_hash}.tar.gz
Source3: https://github.com/python/python-docs-theme/archive/2018.2.tar.gz
Source1: https://github.com/pypa/pypa-docs-theme/archive/%{pypa_theme_commit_hash}.tar.gz
Source2: https://github.com/python/python-docs-theme/archive/2018.2.tar.gz
%endif
# Downstream only patch
@ -91,20 +85,16 @@ Patch3: remove-existing-dist-only-if-path-conflicts.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1655253
Patch4: dummy-certifi.patch
%if %{with tests}
# Mark tests that need the Internet as network tests so we can skip them
# https://github.com/pypa/pip/pull/7359
Patch5: network-tests.patch
%endif
# Don't warn the user about pip._internal.main() entrypoint
# In Fedora, we use that in ensurepip and users cannot do anything about it,
# this warning is juts moot. Also, the warning breaks CPython test suite.
Patch5: nowarn-pip._internal.main.patch
# Dark magic to make pip 19.3+ support the old private API of main()
# This is needed to be able to use pip 19.3+ in ensurepip of older Pythons
# without patching all the Pythons
# A proper fix is discussed in:
# https://discuss.python.org/t/can-we-finally-add-a-minimal-api-to-pip/2833/3
# https://github.com/pypa/pip/pull/7061
# https://github.com/python/cpython/pull/16782
Patch6: callable-main.patch
# Backport: Update tests to be endian safe
# This updates `test_path_to_display` and `test_str_to_display__encoding`
# to use the endian safe expected result instead of the hardcoded one.
# This fixes https://github.com/pypa/pip/issues/7921
Patch6: https://github.com/pypa/pip/commit/b30dd1e04e.patch
# Downstream only patch
# Users might have local installations of pip from using
@ -123,6 +113,10 @@ Patch6: callable-main.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1767212
# WARNING: /usr/bin/pip* are entrypoints, this cannot be applied in %%prep!
# %%patch10 doesn't work outside of %%prep, so we add it as a source
# Note that since pip 20, old main() import paths are preserved for backwards
# compatibility: https://github.com/pypa/pip/issues/7498
# Meaning we don't need to update any of the older pips to support 20+
# We also don't need to update Pythons to use new import path in ensurepip
Source10: pip-allow-different-versions.patch
%description
@ -134,30 +128,32 @@ Packages" or "Pip Installs Python".
# Virtual provides for the packages bundled by pip.
# You can find the versions in src/pip/_vendor/vendor.txt file.
# You can generate it with:
# %%{_rpmconfigdir}/pythonbundles.py --namespace 'python%%{1}dist' src/pip/_vendor/vendor.txt
%global bundled() %{expand:
Provides: bundled(python%{1}dist(appdirs)) = 1.4.3
Provides: bundled(python%{1}dist(CacheControl)) = 0.12.5
Provides: bundled(python%{1}dist(certifi)) = 2019.9.11
Provides: bundled(python%{1}dist(cachecontrol)) = 0.12.6
Provides: bundled(python%{1}dist(certifi)) = 2020.4.5.1
Provides: bundled(python%{1}dist(chardet)) = 3.0.4
Provides: bundled(python%{1}dist(colorama)) = 0.4.1
Provides: bundled(python%{1}dist(contextlib2)) = 0.6.0
Provides: bundled(python%{1}dist(distlib)) = 0.2.9.post0
Provides: bundled(python%{1}dist(distro)) = 1.4.0
Provides: bundled(python%{1}dist(colorama)) = 0.4.3
Provides: bundled(python%{1}dist(contextlib2)) = 0.6^post1
Provides: bundled(python%{1}dist(distlib)) = 0.3
Provides: bundled(python%{1}dist(distro)) = 1.5
Provides: bundled(python%{1}dist(html5lib)) = 1.0.1
Provides: bundled(python%{1}dist(idna)) = 2.8
Provides: bundled(python%{1}dist(ipaddress)) = 1.0.22
Provides: bundled(python%{1}dist(msgpack)) = 0.6.2
Provides: bundled(python%{1}dist(packaging)) = 19.2
Provides: bundled(python%{1}dist(pep517)) = 0.7.0
Provides: bundled(python%{1}dist(idna)) = 2.9
Provides: bundled(python%{1}dist(ipaddress)) = 1.0.23
Provides: bundled(python%{1}dist(msgpack)) = 1
Provides: bundled(python%{1}dist(packaging)) = 20.3
Provides: bundled(python%{1}dist(pep517)) = 0.8.2
Provides: bundled(python%{1}dist(progress)) = 1.5
Provides: bundled(python%{1}dist(pyparsing)) = 2.4.2
Provides: bundled(python%{1}dist(pytoml)) = 0.1.21
Provides: bundled(python%{1}dist(requests)) = 2.22.0
Provides: bundled(python%{1}dist(pyparsing)) = 2.4.7
Provides: bundled(python%{1}dist(requests)) = 2.23
Provides: bundled(python%{1}dist(resolvelib)) = 0.3
Provides: bundled(python%{1}dist(retrying)) = 1.3.3
Provides: bundled(python%{1}dist(setuptools)) = 41.4.0
Provides: bundled(python%{1}dist(six)) = 1.12.0
Provides: bundled(python%{1}dist(urllib3)) = 1.25.6
Provides: bundled(python%{1}dist(setuptools)) = 44
Provides: bundled(python%{1}dist(six)) = 1.14
Provides: bundled(python%{1}dist(toml)) = 0.10
Provides: bundled(python%{1}dist(urllib3)) = 1.25.8
Provides: bundled(python%{1}dist(webencodings)) = 0.5.1
}
@ -185,7 +181,9 @@ Summary: A tool for installing and managing Python3 packages
BuildRequires: python%{python3_pkgversion}-devel
# python3 bootstrap: this is rebuilt before the final build of python3, which
# adds the dependency on python3-rpm-generators, so we require it manually
BuildRequires: python%{python3_pkgversion}-rpm-generators
# Note that the package prefix is always python3-, even if we build for 3.X
# The minimal version is for bundled provides verification script
BuildRequires: python3-rpm-generators >= 11-8
BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: bash-completion
%if %{with tests}
@ -195,17 +193,24 @@ BuildRequires: python%{python3_pkgversion}-pretend
BuildRequires: python%{python3_pkgversion}-freezegun
BuildRequires: python%{python3_pkgversion}-scripttest
BuildRequires: python%{python3_pkgversion}-virtualenv
BuildRequires: python%{python3_pkgversion}-werkzeug
BuildRequires: python%{python3_pkgversion}-pyyaml
%endif
BuildRequires: python%{python3_pkgversion}-wheel
BuildRequires: ca-certificates
Requires: ca-certificates
Requires: python%{python3_pkgversion}-setuptools
# This was previously required and we keep it recommended because a lot of
# sdists installed via pip will try to import setuptools.
# But pip doesn't actually require setuptools.
# It can install wheels without them and it can build wheels in isolation mode
# (using setuptools/flit/poetry/... installed from PyPI).
# Side note: pip bundles pkg_resources from setuptools for internal usage.
Recommends: python%{python3_pkgversion}-setuptools
# Virtual provides for the packages bundled by pip:
%{bundled 3}
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
Provides: pip = %{version}-%{release}
Conflicts: python-pip < %{version}-%{release}
@ -243,36 +248,29 @@ Requires: ca-certificates
A Python wheel of pip to use with venv.
%prep
%setup -q -n %{srcname}-%{version}
%if %{with tests}
tar -xf %{SOURCE1}
%endif
%setup -q -n %{srcname}-%{upstream_version}
%if %{with doc}
pushd docs/html
tar -xf %{SOURCE2}
tar -xf %{SOURCE1}
mv pypa-docs-theme-%{pypa_theme_commit_hash} pypa
tar -xf %{SOURCE3}
tar -xf %{SOURCE2}
mv python-docs-theme-2018.2 python-docs-theme
popd
%endif
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%if %{with tests}
%patch5 -p1
%endif
%patch6 -p1
%autopatch -p1
# this goes together with patch4
rm src/pip/_vendor/certifi/*.pem
sed -i '/\.pem$/d' src/pip.egg-info/SOURCES.txt
%if %{with tests}
# tests expect wheels in here
ln -s %{python_wheeldir} tests/data/common_wheels
%endif
# Upstream uses a Python 2/3 compatibility library for csv with Python 3 semantics in tests
# We only target Python 3 and csv23 is not (yet) packaged
# As of 20.1b1, this workaround was sufficient to get around the missing dependency
sed -i -e 's/csv23/csv/g' tests/lib/wheel.py
%build
@ -283,27 +281,32 @@ export PYTHONPATH=./src/
# from tox.ini
sphinx-build-3 -b html docs/html docs/build/html
sphinx-build-3 -b man docs/man docs/build/man -c docs/html
rm docs/build/html/.buildinfo
rm -rf docs/build/html/{.doctrees,.buildinfo}
%endif
%install
# The following is similar to %%py3_install_wheel, but we don't have
# /usr/bin/pip yet, so we install using the wheel directly.
# (This is not standard wheel usage, but the pip wheel supports it -- see
# pip/__main__.py)
%{__python3} dist/%{python_wheelname}/pip install \
-I 'dist/%{python_wheelname}' \
--root %{buildroot} \
--no-deps
--no-deps \
--no-cache-dir \
--no-index \
--ignore-installed \
--find-links dist \
'pip==%{upstream_version}'
%if %{with doc}
pushd docs/build/man
install -d %{buildroot}%{_mandir}/man1
for MAN in *1; do
install -pm0644 $MAN %{buildroot}%{_mandir}/man1/$MAN
install -pm0644 $MAN %{buildroot}%{_mandir}/man1/${MAN/pip/pip3}
for pip in "pip3" "pip-3" "pip%{python3_version}" "pip-%{python3_version}"; do
echo ".so $MAN" > %{buildroot}%{_mandir}/man1/${MAN/pip/$pip}
done
done
popd
%endif
@ -313,7 +316,6 @@ for PIP in %{buildroot}%{_bindir}/pip*; do
patch -p1 --no-backup-if-mismatch $PIP < %{SOURCE10}
done
mkdir -p %{buildroot}%{bashcompdir}
PYTHONPATH=%{buildroot}%{python3_sitelib} \
%{buildroot}%{_bindir}/pip completion --bash \
@ -331,8 +333,8 @@ ln -s ./pip-%{python3_version} %{buildroot}%{_bindir}/pip-3
# Make sure the INSTALLER is not pip, otherwise Patch2 won't work
# TODO Maybe we should make all our python packages have this?
echo rpm > %{buildroot}%{python3_sitelib}/pip-%{version}.dist-info/INSTALLER
# %%pyproject macros do this for all packages
echo rpm > %{buildroot}%{python3_sitelib}/pip-%{upstream_version}.dist-info/INSTALLER
mkdir -p %{buildroot}%{python_wheeldir}
install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir}
@ -340,23 +342,34 @@ install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir}
%if %{with tests}
%check
# Verify bundled provides are up to date
%{_rpmconfigdir}/pythonbundles.py src/pip/_vendor/vendor.txt --compare-with '%{bundled 3}'
# Upstream tests
# bash completion tests only work from installed package
# needs unaltered sys.path and we cannot do that in %%check
# test_pep517_and_build_options
# test_config_file_venv_option
# TODO investigate failures
# test_uninstall_non_local_distutils
# Incompatible with the latest virtualenv
# test_from_link_vcs_with_source_dir_obtains_commit_id
# test_from_link_vcs_without_source_dir
# test_should_cache_git_sha
pytest_k='not completion and
not test_pep517_and_build_options and
not test_config_file_venv_option and
not test_uninstall_non_local_distutils'
not test_uninstall_non_local_distutils and
not test_from_link_vcs_with_source_dir_obtains_commit_id and
not test_from_link_vcs_without_source_dir and
not test_should_cache_git_sha'
mkdir _bin
export PATH="$PWD/_bin:$PATH"
export PYTHONPATH=%{buildroot}%{python3_sitelib}
ln -sf %{buildroot}%{_bindir}/pip3 _bin/pip
%{__python3} -m pytest -m 'not network' -k "$(echo $pytest_k)"
# --deselect'ed tests are not compatible with the latest virtualenv
# These files contain almost 500 tests so we should enable them back
# as soon as pip will be compatible upstream
# https://github.com/pypa/pip/pull/8441
%pytest -m 'not network' -k "$(echo $pytest_k)" \
--deselect tests/functional --deselect tests/lib/test_lib.py --deselect tests/unit/test_build_env.py
%endif
@ -392,6 +405,42 @@ ln -sf %{buildroot}%{_bindir}/pip3 _bin/pip
%{python_wheeldir}/%{python_wheelname}
%changelog
* Fri Jul 10 2020 Lumír Balhar <lbalhar@redhat.com> - 20.1.1-6
- Do not emit a warning about root privileges when --root is used
* Wed Jul 08 2020 Miro Hrončok <mhroncok@redhat.com> - 20.1.1-5
- Update bundled provides to match 20.1.1
* Tue Jun 16 2020 Lumír Balhar <lbalhar@redhat.com> - 20.1.1-4
- Deselect tests incompatible with the latest virtualenv
* Sun May 24 2020 Miro Hrončok <mhroncok@redhat.com> - 20.1.1-3
- Rebuilt for Python 3.9
* Thu May 21 2020 Miro Hrončok <mhroncok@redhat.com> - 20.1.1-2
- Bootstrap for Python 3.9
* Wed May 20 2020 Tomas Hrnciar <thrnciar@redhat.com> - 20.1.1-1
- Update to 20.1.1
* Wed Apr 29 2020 Tomas Hrnciar <thrnciar@redhat.com> - 20.1-1
- Update to 20.1
* Mon Apr 27 2020 Tomas Hrnciar <thrnciar@redhat.com> - 20.1~b1-1
- Update to 20.1~b1
* Wed Apr 15 2020 Miro Hrončok <mhroncok@redhat.com> - 20.0.2-4
- Only recommend setuptools, don't require them
* Fri Apr 10 2020 Miro Hrončok <mhroncok@redhat.com> - 20.0.2-3
- Allow setting $TMPDIR to $PWD/... during pip wheel (#1806625)
* Tue Mar 10 2020 Miro Hrončok <mhroncok@redhat.com> - 20.0.2-2
- Don't warn the user about pip._internal.main() entrypoint to fix ensurepip
* Mon Mar 02 2020 Miro Hrončok <mhroncok@redhat.com> - 20.0.2-1
- Update to 20.0.2 (#1793456)
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 19.3.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

View File

@ -1,8 +1,8 @@
From 8c58a99221415ca7c3d5ce50dcffefa14e421928 Mon Sep 17 00:00:00 2001
From: Tomas Orsava <torsava@redhat.com>
Date: Tue, 12 Nov 2019 17:24:20 +0100
Subject: [PATCH] Subject: Prevent removing of the system packages installed
under /usr/lib
From d381c59fdc15949c4dc293bd92bbccb60289a703 Mon Sep 17 00:00:00 2001
From: Tomas Hrnciar <thrnciar@redhat.com>
Date: Sun, 26 Apr 2020 21:19:03 +0200
Subject: [PATCH] Prevent removing of the system packages installed under
/usr/lib
when pip install -U is executed.
@ -11,24 +11,45 @@ Resolves: rhbz#1550368
Co-Authored-By: Michal Cyprian <m.cyprian@gmail.com>
Co-Authored-By: Victor Stinner <vstinner@redhat.com>
---
src/pip/_internal/legacy_resolve.py | 5 ++++-
src/pip/_internal/req/req_install.py | 3 ++-
src/pip/_internal/utils/misc.py | 11 +++++++++++
src/pip/_internal/req/req_install.py | 3 ++-
src/pip/_internal/resolution/legacy/resolver.py | 5 ++++-
src/pip/_internal/utils/misc.py | 11 +++++++++++
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/pip/_internal/legacy_resolve.py b/src/pip/_internal/legacy_resolve.py
index c24158f..bd92287 100644
--- a/src/pip/_internal/legacy_resolve.py
+++ b/src/pip/_internal/legacy_resolve.py
@@ -30,6 +30,7 @@ from pip._internal.exceptions import (
)
from pip._internal.utils.logging import indent_log
from pip._internal.utils.misc import (
diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py
index 3b28209b..d14217e9 100644
--- a/src/pip/_internal/req/req_install.py
+++ b/src/pip/_internal/req/req_install.py
@@ -38,6 +38,7 @@ from pip._internal.utils.misc import (
ask_path_exists,
backup_dir,
display_path,
+ dist_in_install_path,
dist_in_site_packages,
dist_in_usersite,
ensure_dir,
normalize_version_info,
@@ -224,7 +225,9 @@ class Resolver(object):
get_installed_version,
@@ -444,7 +445,7 @@ class InstallRequirement(object):
"lack sys.path precedence to {} in {}".format(
existing_dist.project_name, existing_dist.location)
)
- else:
+ elif dist_in_install_path(existing_dist):
self.should_reinstall = True
else:
if self.editable and self.satisfied_by:
diff --git a/src/pip/_internal/resolution/legacy/resolver.py b/src/pip/_internal/resolution/legacy/resolver.py
index cdb44d19..52e122c6 100644
--- a/src/pip/_internal/resolution/legacy/resolver.py
+++ b/src/pip/_internal/resolution/legacy/resolver.py
@@ -33,6 +33,7 @@ from pip._internal.resolution.base import BaseResolver
from pip._internal.utils.compatibility_tags import get_supported
from pip._internal.utils.logging import indent_log
from pip._internal.utils.misc import dist_in_usersite, normalize_version_info
+from pip._internal.utils.misc import dist_in_install_path
from pip._internal.utils.packaging import (
check_requires_python,
get_requires_python,
@@ -203,7 +204,9 @@ class Resolver(BaseResolver):
"""
# Don't uninstall the conflict if doing a user install and the
# conflict is not a user install.
@ -36,35 +57,14 @@ index c24158f..bd92287 100644
+ if ((not self.use_user_site
+ or dist_in_usersite(req.satisfied_by))
+ and dist_in_install_path(req.satisfied_by)):
req.conflicts_with = req.satisfied_by
req.should_reinstall = True
req.satisfied_by = None
diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py
index 5a8c0dc..f80ba87 100644
--- a/src/pip/_internal/req/req_install.py
+++ b/src/pip/_internal/req/req_install.py
@@ -39,6 +39,7 @@ from pip._internal.utils.misc import (
ask_path_exists,
backup_dir,
display_path,
+ dist_in_install_path,
dist_in_site_packages,
dist_in_usersite,
ensure_dir,
@@ -461,7 +462,7 @@ class InstallRequirement(object):
"lack sys.path precedence to %s in %s" %
(existing_dist.project_name, existing_dist.location)
)
- else:
+ elif dist_in_install_path(existing_dist):
self.conflicts_with = existing_dist
return True
diff --git a/src/pip/_internal/utils/misc.py b/src/pip/_internal/utils/misc.py
index b848263..5b75fed 100644
index 09031825..3c064f8f 100644
--- a/src/pip/_internal/utils/misc.py
+++ b/src/pip/_internal/utils/misc.py
@@ -28,6 +28,7 @@ from pip._vendor.six.moves.urllib.parse import unquote as urllib_unquote
@@ -29,6 +29,7 @@ from pip._vendor.six.moves.urllib.parse import unquote as urllib_unquote
from pip import __version__
from pip._internal.exceptions import CommandError
from pip._internal.locations import (
@ -72,7 +72,7 @@ index b848263..5b75fed 100644
get_major_minor_version,
site_packages,
user_site,
@@ -389,6 +390,16 @@ def dist_in_site_packages(dist):
@@ -400,6 +401,16 @@ def dist_in_site_packages(dist):
return dist_location(dist).startswith(normalize_path(site_packages))
@ -90,5 +90,6 @@ index b848263..5b75fed 100644
# type: (Distribution) -> bool
"""
--
2.20.1
2.23.0

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,3 @@
SHA512 (pip-19.3.1.tar.gz) = 954b390580e23d0a85d1fa4cbd2f35171df7930fbe346f9a809477fe133e95f7d30208d79b5d07f30c81ab1b0a9b52f36f3ff6c77dc81a1c9ab9beb2bd8e0aa1
SHA512 (pip-19.3.1-tests.tar.gz) = fb058fcaaff3325341af5f4746be0c7943953c43fb721124758320363532911ca399f254a58e347c72795adc41764600bc6d02efce0e1e27d4b6d130efad9945
SHA512 (pip-20.1.1.tar.gz) = ee7b0345c08fbe0215811d07b4c57c1ceece826871842f6d1c174d82e8eee0ad810aa5413d6763ecd5a513e151792a53c36623ab99d2049555ef2542d32d1658
SHA512 (d2e63fbfc62af3b7050f619b2f5bb8658985b931.tar.gz) = fc7b11c5cbf6322469ce2eaca2a8d7eb60b17398d316f7465ab5d3d38dabd00ee22a3da7437a28f6312f0115f77f2df0d8bf0abc671e055eef06356c94283409
SHA512 (2018.2.tar.gz) = 4c09c43a70ecb3ca3bc9445b01bf209eb382e41d9c969145696dea38551992ed88fd9b725a1264380f3dbdf8acdaf5ada3ef86b44255cdfbdbe4a01a1630912d

View File

@ -7,6 +7,8 @@
repositories:
- repo: "https://src.fedoraproject.org/tests/python.git"
dest: "python"
- repo: "https://src.fedoraproject.org/rpms/pyproject-rpm-macros.git"
dest: "pyproject-rpm-macros"
tests:
- smoke34:
dir: python/smoke
@ -23,6 +25,9 @@
- smoke38:
dir: python/smoke
run: VERSION=3.8 ./venv.sh
- smoke39:
dir: python/smoke
run: VERSION=3.9 ./venv.sh
- smoke27:
dir: python/smoke
run: VERSION=2.7 METHOD=virtualenv ./venv.sh
@ -41,8 +46,23 @@
- smoke38_virtualenv:
dir: python/smoke
run: VERSION=3.8 METHOD=virtualenv ./venv.sh
- smoke39_virtualenv:
dir: python/smoke
run: VERSION=3.9 METHOD=virtualenv ./venv.sh
- pipenv:
run: pipenv --three && pipenv install six
- pyproject_pytest:
dir: pyproject-rpm-macros/tests
run: ./mocktest.sh python-pytest
- pyproject_entrypoints:
dir: pyproject-rpm-macros/tests
run: ./mocktest.sh python-entrypoints
- pyproject_pluggy:
dir: pyproject-rpm-macros/tests
run: ./mocktest.sh python-pluggy
- pyproject_clikit:
dir: pyproject-rpm-macros/tests
run: ./mocktest.sh python-clikit
required_packages:
- gcc
- virtualenv
@ -52,7 +72,11 @@
- python36
- python37
- python38
- python39
- python2-devel
- python3-devel
- python3-tox
- pipenv
- mock
- rpmdevtools
- rpm-build