Fix incomplete pip-updates in virtual environments

This commit is contained in:
Miro Hrončok 2021-10-15 09:36:43 +02:00
parent 20ae7fd440
commit 5e3e97d02b
2 changed files with 5 additions and 3 deletions

View File

@ -406,6 +406,7 @@ pytest_k='not completion and
* Wed Oct 13 2021 Miro Hrončok <mhroncok@redhat.com> - 21.3-1
- Update to 21.3
- Resolves: rhbz#2013026
- Fix incomplete pip-updates in virtual environments
* Wed Oct 06 2021 Charalampos Stratakis <cstratak@redhat.com> - 21.2.3-4
- Remove bundled windows executables

View File

@ -71,10 +71,11 @@ diff --git a/src/pip/_internal/resolution/resolvelib/factory.py b/src/pip/_inter
index 766dc26..c8c1cd8 100644
--- a/src/pip/_internal/resolution/resolvelib/factory.py
+++ b/src/pip/_internal/resolution/resolvelib/factory.py
@@ -1,6 +1,7 @@
@@ -1,6 +1,8 @@
import contextlib
import functools
import logging
+import sys
+import sysconfig
from typing import (
TYPE_CHECKING,
@ -102,8 +103,8 @@ index 766dc26..c8c1cd8 100644
+ # Prevent uninstalling packages from /usr
+ try:
+ if dist_location(dist._dist) in (
+ sysconfig.get_path('purelib', scheme='rpm_prefix'),
+ sysconfig.get_path('platlib', scheme='rpm_prefix'),
+ sysconfig.get_path('purelib', scheme='rpm_prefix', vars={'base': sys.base_prefix}),
+ sysconfig.get_path('platlib', scheme='rpm_prefix', vars={'base': sys.base_prefix}),
+ ):
+ return None
+ except KeyError: # this Python doesn't have 'rpm_prefix' scheme yet