From e9e8996aeb56acefddec141c0acfe33cac24595c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 16 Aug 2021 12:26:06 +0200 Subject: [PATCH] Fix broken uninstallation by a bogus downstream patch In pip 21.2, the Distribution here is a wrapper around the regular Distribution. It has a limited set of API defined by the BaseDistribution protocol. dist_location() uses the project_name attribute under the hood -- and that is not part of the API. If we ever upstream this, we should make this check a property of BaseDistribution. But, for now, we hotfix it by accessing the private wrapped Distribution object directly. Yes, this is ugly. Related: rhbz#1932713 --- python-pip.spec | 5 ++++- remove-existing-dist-only-if-path-conflicts.patch | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/python-pip.spec b/python-pip.spec index 0bd7458..d7a1ef0 100644 --- a/python-pip.spec +++ b/python-pip.spec @@ -22,7 +22,7 @@ Name: python-%{srcname} Version: %{base_version}%{?prerel:~%{prerel}} -Release: 1%{?dist} +Release: 2%{?dist} Summary: A tool for installing and managing Python packages # We bundle a lot of libraries with pip, which itself is under MIT license. @@ -394,6 +394,9 @@ pytest_k='not completion and %{python_wheeldir}/%{python_wheelname} %changelog +* Mon Sep 13 2021 Miro Hrončok - 21.2.3-2 +- Fix broken uninstallation by a bogus downstream patch + * Mon Sep 13 2021 Miro Hrončok - 21.2.3-1 - Update to 21.2.3 - Resolves: rhbz#1985635 diff --git a/remove-existing-dist-only-if-path-conflicts.patch b/remove-existing-dist-only-if-path-conflicts.patch index 56c7e2f..e68e892 100644 --- a/remove-existing-dist-only-if-path-conflicts.patch +++ b/remove-existing-dist-only-if-path-conflicts.patch @@ -1,4 +1,4 @@ -From a722cbefa5e1a4bf5357f13852fa927a46fcd624 Mon Sep 17 00:00:00 2001 +From aca0c9df4ef54f70a3fedb07f4faac463f88a331 Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Mon, 10 May 2021 18:16:20 +0200 Subject: [PATCH] Prevent removing of the system packages installed under @@ -12,6 +12,7 @@ Co-Authored-By: Michal Cyprian Co-Authored-By: Victor Stinner Co-Authored-By: Petr Viktorin Co-Authored-By: Lumir Balhar +Co-Authored-By: Miro Hrončok --- src/pip/_internal/req/req_install.py | 3 ++- src/pip/_internal/resolution/legacy/resolver.py | 5 ++++- @@ -64,7 +65,7 @@ index 4df8f7e..dda2292 100644 req.satisfied_by = None diff --git a/src/pip/_internal/resolution/resolvelib/factory.py b/src/pip/_internal/resolution/resolvelib/factory.py -index e7fd344..e36f025 100644 +index e7fd344..555e657 100644 --- a/src/pip/_internal/resolution/resolvelib/factory.py +++ b/src/pip/_internal/resolution/resolvelib/factory.py @@ -1,6 +1,7 @@ @@ -96,7 +97,7 @@ index e7fd344..e36f025 100644 return None + # Prevent uninstalling packages from /usr -+ if dist_location(dist) in ( ++ if dist_location(dist._dist) in ( + get_scheme('', prefix=sys.base_prefix).purelib, + get_scheme('', prefix=sys.base_prefix).platlib, + ):