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 * Wed Oct 13 2021 Miro Hrončok <mhroncok@redhat.com> - 21.3-1
- Update to 21.3 - Update to 21.3
- Resolves: rhbz#2013026 - Resolves: rhbz#2013026
- Fix incomplete pip-updates in virtual environments
* Wed Oct 06 2021 Charalampos Stratakis <cstratak@redhat.com> - 21.2.3-4 * Wed Oct 06 2021 Charalampos Stratakis <cstratak@redhat.com> - 21.2.3-4
- Remove bundled windows executables - 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 index 766dc26..c8c1cd8 100644
--- a/src/pip/_internal/resolution/resolvelib/factory.py --- a/src/pip/_internal/resolution/resolvelib/factory.py
+++ b/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 contextlib
import functools import functools
import logging import logging
+import sys
+import sysconfig +import sysconfig
from typing import ( from typing import (
TYPE_CHECKING, TYPE_CHECKING,
@ -102,8 +103,8 @@ index 766dc26..c8c1cd8 100644
+ # Prevent uninstalling packages from /usr + # Prevent uninstalling packages from /usr
+ try: + try:
+ if dist_location(dist._dist) in ( + if dist_location(dist._dist) in (
+ sysconfig.get_path('purelib', scheme='rpm_prefix'), + sysconfig.get_path('purelib', scheme='rpm_prefix', vars={'base': sys.base_prefix}),
+ sysconfig.get_path('platlib', scheme='rpm_prefix'), + sysconfig.get_path('platlib', scheme='rpm_prefix', vars={'base': sys.base_prefix}),
+ ): + ):
+ return None + return None
+ except KeyError: # this Python doesn't have 'rpm_prefix' scheme yet + except KeyError: # this Python doesn't have 'rpm_prefix' scheme yet