#76 Upgrade to 20.3
Merged 3 years ago by pviktori. Opened 3 years ago by pviktori.
rpms/ pviktori/python-pip v20.3  into  master

file removed
-11
@@ -1,11 +0,0 @@ 

- diff -ru pip-10.0.1/docs/conf.py pip-10.0.1_patched/docs/conf.py

- --- pip-10.0.1/docs/html/conf.py	2018-04-14 13:17:31.000000000 +0200

- +++ pip-10.0.1_patched/docs/html/conf.py	2018-07-23 15:23:31.053267611 +0200

- @@ -134,6 +134,7 @@

-  # The theme to use for HTML and HTML Help pages.  Major themes that come with

-  # Sphinx are currently 'default' and 'sphinxdoc'.

-  html_theme = "pypa_theme"

- +html_theme_path = ["pypa", "python-docs-theme"]

-  

-  # Theme options are theme-specific and customize the look and feel of a theme

-  # further.  For a list of options available for each theme, see the

@@ -0,0 +1,15 @@ 

+ diff -rU3 pip-20.3-orig/src/pip/_vendor/packaging/version.py pip-20.3/src/pip/_vendor/packaging/version.py

+ --- pip-20.3-orig/src/pip/_vendor/packaging/version.py	2020-11-30 12:58:32.000000000 +0100

+ +++ pip-20.3/src/pip/_vendor/packaging/version.py	2020-12-16 21:25:15.818221608 +0100

+ @@ -124,11 +124,6 @@

+          self._version = str(version)

+          self._key = _legacy_cmpkey(self._version)

+  

+ -        warnings.warn(

+ -            "Creating a LegacyVersion has been deprecated and will be "

+ -            "removed in the next major release",

+ -            DeprecationWarning,

+ -        )

+  

+      def __str__(self):

+          # type: () -> str

@@ -26,7 +26,7 @@ 

  --- 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

+      from typing import List, Optional

   

   

  -def _wrapper(args=None):

file modified
+34 -38
@@ -13,21 +13,16 @@ 

  %endif

  

  %global srcname pip

- %global base_version 20.2.4

+ %global base_version 20.3.3

  %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}

- # Commit hash to use from the repo https://github.com/pypa/pypa-docs-theme

- %global pypa_theme_commit_hash d2e63fbfc62af3b7050f619b2f5bb8658985b931

- %endif

- 

  %global bashcompdir %(pkg-config --variable=completionsdir bash-completion 2>/dev/null)

  

  Name:           python-%{srcname}

  Version:        %{base_version}%{?prerel:~%{prerel}}

- Release:        2%{?dist}

+ Release:        3%{?dist}

  Summary:        A tool for installing and managing Python packages

  

  # We bundle a lot of libraries with pip, which itself is under MIT license.
@@ -73,20 +68,12 @@ 

  BuildRequires:  python-wheel-wheel

  %endif

  

- # Themes required to build the docs.

- %if %{with doc}

- 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

  # Emit a warning to the user if pip install is run with root privileges

- # Issue upstream: https://github.com/pypa/pip/issues/4288

+ # Upstream discussion:

+ #  https://discuss.python.org/t/playing-nice-with-external-package-managers/1968/20

  Patch1:         emit-a-warning-when-running-with-root-privileges.patch

  

- # Add path to the doc themes to conf.py

- Patch2:         html_theme_path.patch

- 

  # Prevent removing of the system packages installed under /usr/lib

  # when pip install -U is executed.

  # https://bugzilla.redhat.com/show_bug.cgi?id=1550368#c24
@@ -101,6 +88,11 @@ 

  # this warning is juts moot. Also, the warning breaks CPython test suite.

  Patch5:         nowarn-pip._internal.main.patch

  

+ # Don't warn the user about packaging's LegacyVersion being deprecated.

+ # (This also breaks Python's test suite when warnings are treated as errors.)

+ # Upstream issue: https://github.com/pypa/packaging/issues/368

+ Patch6:         no-version-warning.patch

+ 

  # Downstream only patch

  # Users might have local installations of pip from using

  # `pip install --user --upgrade pip` on older/newer versions.
@@ -138,9 +130,9 @@ 

  %global bundled() %{expand:

  Provides: bundled(python%{1}dist(appdirs)) = 1.4.4

  Provides: bundled(python%{1}dist(cachecontrol)) = 0.12.6

- Provides: bundled(python%{1}dist(certifi)) = 2020.6.20

+ Provides: bundled(python%{1}dist(certifi)) = 2020.11.8

  Provides: bundled(python%{1}dist(chardet)) = 3.0.4

- Provides: bundled(python%{1}dist(colorama)) = 0.4.3

+ Provides: bundled(python%{1}dist(colorama)) = 0.4.4

  Provides: bundled(python%{1}dist(contextlib2)) = 0.6^post1

  Provides: bundled(python%{1}dist(distlib)) = 0.3.1

  Provides: bundled(python%{1}dist(distro)) = 1.5
@@ -148,17 +140,17 @@ 

  Provides: bundled(python%{1}dist(idna)) = 2.10

  Provides: bundled(python%{1}dist(ipaddress)) = 1.0.23

  Provides: bundled(python%{1}dist(msgpack)) = 1

- Provides: bundled(python%{1}dist(packaging)) = 20.4

- Provides: bundled(python%{1}dist(pep517)) = 0.8.2

+ Provides: bundled(python%{1}dist(packaging)) = 20.8

+ Provides: bundled(python%{1}dist(pep517)) = 0.9.1

  Provides: bundled(python%{1}dist(progress)) = 1.5

  Provides: bundled(python%{1}dist(pyparsing)) = 2.4.7

- Provides: bundled(python%{1}dist(requests)) = 2.24

- Provides: bundled(python%{1}dist(resolvelib)) = 0.4

+ Provides: bundled(python%{1}dist(requests)) = 2.25

+ Provides: bundled(python%{1}dist(resolvelib)) = 0.5.3

  Provides: bundled(python%{1}dist(retrying)) = 1.3.3

  Provides: bundled(python%{1}dist(setuptools)) = 44

  Provides: bundled(python%{1}dist(six)) = 1.15

- Provides: bundled(python%{1}dist(toml)) = 0.10.1

- Provides: bundled(python%{1}dist(urllib3)) = 1.25.9

+ Provides: bundled(python%{1}dist(toml)) = 0.10.2

+ Provides: bundled(python%{1}dist(urllib3)) = 1.26.2

  Provides: bundled(python%{1}dist(webencodings)) = 0.5.1

  }

  
@@ -233,6 +225,7 @@ 

  Summary:        A documentation for a tool for installing and managing Python packages

  

  BuildRequires:  python%{python3_pkgversion}-sphinx

+ BuildRequires:  python%{python3_pkgversion}-sphinx-inline-tabs

  

  %description doc

  A documentation for a tool for installing and managing Python packages
@@ -254,22 +247,15 @@ 

  A Python wheel of pip to use with venv.

  

  %prep

- %setup -q -n %{srcname}-%{upstream_version}

- 

- %if %{with doc}

- pushd docs/html

- tar -xf %{SOURCE1}

- mv pypa-docs-theme-%{pypa_theme_commit_hash} pypa

- tar -xf %{SOURCE2}

- mv python-docs-theme-2018.2 python-docs-theme

- popd

- %endif

- 

- %autopatch -p1

+ %autosetup -p1 -n %{srcname}-%{upstream_version}

  

  # this goes together with patch4

  rm src/pip/_vendor/certifi/*.pem

  

+ # Do not use furo as HTML theme in docs

+ # furo is not available in Fedora

+ sed -i '/html_theme = "furo"/d' docs/html/conf.py

+ 

  # tests expect wheels in here

  ln -s %{python_wheeldir} tests/data/common_wheels

  
@@ -338,9 +324,10 @@ 

  ln -s ./pip-%{python3_version} %{buildroot}%{_bindir}/pip-3

  

  

- # Make sure the INSTALLER is not pip, otherwise Patch2 won't work

+ # Make sure the INSTALLER is not pip and remove RECORD

  # %%pyproject macros do this for all packages

  echo rpm > %{buildroot}%{python3_sitelib}/pip-%{upstream_version}.dist-info/INSTALLER

+ rm %{buildroot}%{python3_sitelib}/pip-%{upstream_version}.dist-info/RECORD

  

  mkdir -p %{buildroot}%{python_wheeldir}

  install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir}
@@ -411,6 +398,15 @@ 

  %{python_wheeldir}/%{python_wheelname}

  

  %changelog

+ * Thu Dec 17 2020 Petr Viktorin <pviktori@redhat.com> - 20.3.3-1

+ - Update to 20.3.3

+ 

+ * Mon Nov 30 2020 Miro Hrončok <mhroncok@redhat.com> - 20.3-1

+ - Update to 20.3

+ - Add support for PEP 600: Future manylinux Platform Tags

+ - New resolver

+ - Fixes: rhbz#1893470

+ 

  * Fri Dec 04 2020 Miro Hrončok <mhroncok@redhat.com> - 20.2.4-2

  - Disable tests and documentation in Fedora ELN (and RHEL)

  

@@ -10,17 +10,13 @@ 

  

  Co-Authored-By: Michal Cyprian <m.cyprian@gmail.com>

  Co-Authored-By: Victor Stinner <vstinner@redhat.com>

+ Co-Authored-By: Petr Viktorin <pviktori@redhat.com>

  ---

-  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/req/req_install.py b/src/pip/_internal/req/req_install.py

  index 4759f4a..2e76e35 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 (

+ @@ -41,6 +41,7 @@ from pip._internal.utils.misc import (

       ask_path_exists,

       backup_dir,

       display_path,
@@ -28,7 +24,7 @@ 

       dist_in_site_packages,

       dist_in_usersite,

       get_distribution,

- @@ -446,7 +447,7 @@ class InstallRequirement(object):

+ @@ -447,7 +448,7 @@ class InstallRequirement(object):

                           "lack sys.path precedence to {} in {}".format(

                               existing_dist.project_name, existing_dist.location)

                       )
@@ -46,10 +42,10 @@ 

   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,

- @@ -207,7 +208,9 @@ class Resolver(BaseResolver):

+  from pip._internal.utils.packaging import check_requires_python, get_requires_python

+  from pip._internal.utils.typing import MYPY_CHECK_RUNNING

+  

+ @@ -204,7 +205,9 @@ class Resolver(BaseResolver):

           """

           # Don't uninstall the conflict if doing a user install and the

           # conflict is not a user install.
@@ -64,15 +60,16 @@ 

  index 24a7455..5fd48d3 100644

  --- a/src/pip/_internal/utils/misc.py

  +++ b/src/pip/_internal/utils/misc.py

- @@ -31,6 +31,7 @@ from pip._vendor.six.moves.urllib.parse import unquote as urllib_unquote

+ @@ -31,7 +31,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 (

- +    distutils_scheme,

-      get_major_minor_version,

-      site_packages,

-      user_site,

- @@ -403,6 +404,16 @@ def dist_in_site_packages(dist):

+ -from pip._internal.locations import get_major_minor_version, site_packages, user_site

+ +from pip._internal.locations import distutils_scheme, get_major_minor_version, site_packages, user_site

+  from pip._internal.utils.compat import WINDOWS, expanduser, stdlib_pkgs, str_to_display

+  from pip._internal.utils.typing import MYPY_CHECK_RUNNING, cast

+  from pip._internal.utils.virtualenv import (

+ @@ -406,6 +406,16 @@ def dist_in_site_packages(dist):

       return dist_location(dist).startswith(normalize_path(site_packages))

   

   
@@ -89,6 +86,33 @@ 

   def dist_is_editable(dist):

       # type: (Distribution) -> bool

       """

+ --- a/src/pip/_internal/resolution/resolvelib/factory.py

+ +++ b/src/pip/_internal/resolution/resolvelib/factory.py

+ @@ -1,3 +1,4 @@

+  import logging

+ +import sys

+  

+  from pip._vendor.packaging.utils import canonicalize_name

+ @@ -17,5 +18,7 @@

+      dist_in_usersite,

+      get_installed_distributions,

+ +    dist_location,

+  )

+ +from pip._internal.locations import distutils_scheme

+  from pip._internal.utils.typing import MYPY_CHECK_RUNNING

+  from pip._internal.utils.virtualenv import running_under_virtualenv

+ @@ -313,4 +316,11 @@

+              return None

+  

+ +        # Prevent uninstalling packages from /usr

+ +        if dist_location(dist) in (

+ +                distutils_scheme('', prefix=sys.base_prefix)['purelib'],

+ +                distutils_scheme('', prefix=sys.base_prefix)['platlib'],

+ +            ):

+ +            return None

+ +

+          # We're installing into global site. The current installation must

+          # be uninstalled, no matter it's in global or user site, because the

  -- 

  2.25.4

  

file modified
+1 -3
@@ -1,3 +1,1 @@ 

- SHA512 (pip-20.2.4.tar.gz) = 649fdc6baa1ebe741717bd1e5ed8f2450d79f8bc0d06f2804c27488be9018f6fa6cc2eccc3ec2801442073f59ac0b8c377612c25116126aa919aa95050f4214f

- SHA512 (d2e63fbfc62af3b7050f619b2f5bb8658985b931.tar.gz) = fc7b11c5cbf6322469ce2eaca2a8d7eb60b17398d316f7465ab5d3d38dabd00ee22a3da7437a28f6312f0115f77f2df0d8bf0abc671e055eef06356c94283409

- SHA512 (2018.2.tar.gz) = 4c09c43a70ecb3ca3bc9445b01bf209eb382e41d9c969145696dea38551992ed88fd9b725a1264380f3dbdf8acdaf5ada3ef86b44255cdfbdbe4a01a1630912d

+ SHA512 (pip-20.3.3.tar.gz) = 362d20e5d2665fa6211cf3836ca02a0340fb34ecde1d5902eecae744eb655d7dcfed0bd464e9db186b87b63a7aaf275e43645cf6321bdddd44b62787de84d87b

This continues from https://src.fedoraproject.org/rpms/python-pip/pull-request/75
I rebased the patches and added a new change to the new resolver (pip/_internal/resolution/resolvelib) to prevent removing system packages in updates.

Build succeeded.

I did a little bit of testing and
sudo pip install and then uninstall operates on /usr/local. The install step produces the correct warning.
sudo dnf install and then pip uninstall still "works" → pip is able to uninstall packages from /usr/lib. The same applies when I'm in a virtual environment with access to system site packages. This obviously does not apply to packages produced by pyproject macros because they don't have RECORD files.

It seems okay to me because AFAIK the older (current) version of pip behaves in the same way but I have a feeling that the new patch tries to prevent pip from uninstalling packages from /usr/lib and from that point of view, it does not work.

Am I right? What else I can test?

Right, the patch doesn't affect uninstalls.
One more thing to test is sudo dnf install and then sudo pip install -U to a newer version.

sudo dnf install -y python3-sqlparse installs version 0.3.1 to /usr/lib and then sudo pip install -U sqlparse installs newer version 0.4.1 to /usr/local. With python3 -Is you get the system one, pure python3 loads the newer one.

The only problem here is a small difference in the output of old/new pip. The new one reports that the requirement is already satisfied which is not good I'd say:

# sudo pip install -U sqlparse
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip install --user` instead.
Requirement already satisfied: sqlparse in /usr/lib/python3.9/site-packages (0.3.1)
Collecting sqlparse
  Downloading sqlparse-0.4.1-py3-none-any.whl (42 kB)
     |████████████████████████████████| 42 kB 409 kB/s 
Installing collected packages: sqlparse
Successfully installed sqlparse-0.4.1

AFAIK, the new pip does that for all updates.

Hm, the new bundled packaging adds a new DeprecationWarning that breaks strict CPython tests. I'll add one more patch.

1 new commit added

  • Remove DeprecationWarning about LegacyVersion
3 years ago

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.

On Tuesday, a new pip came out that fixes several bugs (including the "Requirement already satisfied"). I'll update to that.

1 new commit added

  • Update to 20.3.3
3 years ago

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.

rebased onto 58c5acd

3 years ago

Build succeeded.

I can't find any more issues; time to push to Rawhide for wider testing.

Pull-Request has been merged by pviktori

3 years ago

Thanks @pviktori for taking care of this!