Patch the new resolver to not uninstall from /usr/lib on updates
This commit is contained in:
parent
0626df487e
commit
6eac568430
@ -10,12 +10,8 @@ Resolves: rhbz#1550368
|
||||
|
||||
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
|
||||
@ -90,6 +86,33 @@ index 24a7455..5fd48d3 100644
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user