|
|
|
@ -1,10 +1,11 @@
|
|
|
|
|
From aca0c9df4ef54f70a3fedb07f4faac463f88a331 Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: Karolina Surma <ksurma@redhat.com>
|
|
|
|
|
Date: Mon, 10 May 2021 18:16:20 +0200
|
|
|
|
|
From f5c7cdc676e6884580fde4689a296ff50a9847a5 Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: Lumir Balhar <lbalhar@redhat.com>
|
|
|
|
|
Date: Wed, 20 Mar 2024 13:43:12 +0100
|
|
|
|
|
Subject: [PATCH] Prevent removing of the system packages installed under
|
|
|
|
|
/usr/lib
|
|
|
|
|
|
|
|
|
|
when pip install -U is executed.
|
|
|
|
|
/usr/lib when pip install -U is executed.
|
|
|
|
|
MIME-Version: 1.0
|
|
|
|
|
Content-Type: text/plain; charset=UTF-8
|
|
|
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
|
|
|
|
|
|
Resolves: rhbz#1550368
|
|
|
|
|
|
|
|
|
@ -21,10 +22,10 @@ Co-Authored-By: Miro Hrončok <miro@hroncok.cz>
|
|
|
|
|
4 files changed, 27 insertions(+), 2 deletions(-)
|
|
|
|
|
|
|
|
|
|
diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py
|
|
|
|
|
index 4c58cdb..3570e17 100644
|
|
|
|
|
index 95dacab..b9679fa 100644
|
|
|
|
|
--- a/src/pip/_internal/req/req_install.py
|
|
|
|
|
+++ b/src/pip/_internal/req/req_install.py
|
|
|
|
|
@@ -43,6 +43,7 @@ from pip._internal.utils.misc import (
|
|
|
|
|
@@ -47,6 +47,7 @@ from pip._internal.utils.misc import (
|
|
|
|
|
ask_path_exists,
|
|
|
|
|
backup_dir,
|
|
|
|
|
display_path,
|
|
|
|
@ -32,9 +33,9 @@ index 4c58cdb..3570e17 100644
|
|
|
|
|
dist_in_site_packages,
|
|
|
|
|
dist_in_usersite,
|
|
|
|
|
get_distribution,
|
|
|
|
|
@@ -426,7 +427,7 @@ class InstallRequirement:
|
|
|
|
|
"lack sys.path precedence to {} in {}".format(
|
|
|
|
|
existing_dist.project_name, existing_dist.location)
|
|
|
|
|
@@ -442,7 +443,7 @@ class InstallRequirement:
|
|
|
|
|
existing_dist.project_name, existing_dist.location
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
- else:
|
|
|
|
|
+ elif dist_in_install_path(existing_dist):
|
|
|
|
@ -42,18 +43,18 @@ index 4c58cdb..3570e17 100644
|
|
|
|
|
else:
|
|
|
|
|
if self.editable:
|
|
|
|
|
diff --git a/src/pip/_internal/resolution/legacy/resolver.py b/src/pip/_internal/resolution/legacy/resolver.py
|
|
|
|
|
index 4df8f7e..dda2292 100644
|
|
|
|
|
index 09caaa6..c1542ec 100644
|
|
|
|
|
--- a/src/pip/_internal/resolution/legacy/resolver.py
|
|
|
|
|
+++ b/src/pip/_internal/resolution/legacy/resolver.py
|
|
|
|
|
@@ -42,6 +42,7 @@ from pip._internal.resolution.base import BaseResolver, InstallRequirementProvid
|
|
|
|
|
@@ -44,6 +44,7 @@ from pip._internal.resolution.base import BaseResolver, InstallRequirementProvid
|
|
|
|
|
from pip._internal.utils.compatibility_tags import get_supported
|
|
|
|
|
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
|
|
|
|
|
from pip._internal.utils.packaging import check_requires_python
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
@@ -194,7 +195,9 @@ class Resolver(BaseResolver):
|
|
|
|
|
@@ -203,7 +204,9 @@ class Resolver(BaseResolver):
|
|
|
|
|
"""
|
|
|
|
|
# Don't uninstall the conflict if doing a user install and the
|
|
|
|
|
# conflict is not a user install.
|
|
|
|
@ -65,7 +66,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..555e657 100644
|
|
|
|
|
index 766dc26..baf61ba 100644
|
|
|
|
|
--- a/src/pip/_internal/resolution/resolvelib/factory.py
|
|
|
|
|
+++ b/src/pip/_internal/resolution/resolvelib/factory.py
|
|
|
|
|
@@ -1,6 +1,7 @@
|
|
|
|
@ -76,7 +77,7 @@ index e7fd344..555e657 100644
|
|
|
|
|
from typing import (
|
|
|
|
|
TYPE_CHECKING,
|
|
|
|
|
Dict,
|
|
|
|
|
@@ -34,6 +35,7 @@ from pip._internal.exceptions import (
|
|
|
|
|
@@ -33,6 +34,7 @@ from pip._internal.exceptions import (
|
|
|
|
|
UnsupportedWheel,
|
|
|
|
|
)
|
|
|
|
|
from pip._internal.index.package_finder import PackageFinder
|
|
|
|
@ -84,15 +85,15 @@ index e7fd344..555e657 100644
|
|
|
|
|
from pip._internal.metadata import BaseDistribution, get_default_environment
|
|
|
|
|
from pip._internal.models.link import Link
|
|
|
|
|
from pip._internal.models.wheel import Wheel
|
|
|
|
|
@@ -46,6 +48,7 @@ from pip._internal.req.req_install import (
|
|
|
|
|
@@ -45,6 +47,7 @@ from pip._internal.req.req_install import (
|
|
|
|
|
from pip._internal.resolution.base import InstallRequirementProvider
|
|
|
|
|
from pip._internal.utils.compatibility_tags import get_supported
|
|
|
|
|
from pip._internal.utils.hashes import Hashes
|
|
|
|
|
+from pip._internal.utils.misc import dist_location
|
|
|
|
|
from pip._internal.utils.packaging import get_requirement
|
|
|
|
|
from pip._internal.utils.virtualenv import running_under_virtualenv
|
|
|
|
|
|
|
|
|
|
from .base import Candidate, CandidateVersion, Constraint, Requirement
|
|
|
|
|
@@ -525,6 +528,13 @@ class Factory:
|
|
|
|
|
@@ -526,6 +529,13 @@ class Factory:
|
|
|
|
|
if dist is None: # Not installed, no uninstallation required.
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
@ -107,18 +108,18 @@ index e7fd344..555e657 100644
|
|
|
|
|
# be uninstalled, no matter it's in global or user site, because the
|
|
|
|
|
# user site installation has precedence over global.
|
|
|
|
|
diff --git a/src/pip/_internal/utils/misc.py b/src/pip/_internal/utils/misc.py
|
|
|
|
|
index 99ebea3..5901687 100644
|
|
|
|
|
index d3e9053..d25d1c3 100644
|
|
|
|
|
--- a/src/pip/_internal/utils/misc.py
|
|
|
|
|
+++ b/src/pip/_internal/utils/misc.py
|
|
|
|
|
@@ -40,6 +40,7 @@ from pip._vendor.tenacity import retry, stop_after_delay, wait_fixed
|
|
|
|
|
@@ -38,6 +38,7 @@ from pip._vendor.tenacity import retry, stop_after_delay, wait_fixed
|
|
|
|
|
from pip import __version__
|
|
|
|
|
from pip._internal.exceptions import CommandError
|
|
|
|
|
from pip._internal.locations import get_major_minor_version, site_packages, user_site
|
|
|
|
|
+from pip._internal.locations import get_scheme
|
|
|
|
|
from pip._internal.utils.compat import WINDOWS, stdlib_pkgs
|
|
|
|
|
from pip._internal.utils.virtualenv import (
|
|
|
|
|
running_under_virtualenv,
|
|
|
|
|
@@ -382,6 +383,16 @@ def dist_in_site_packages(dist):
|
|
|
|
|
from pip._internal.utils.compat import WINDOWS
|
|
|
|
|
from pip._internal.utils.egg_link import egg_link_path_from_location
|
|
|
|
|
from pip._internal.utils.virtualenv import running_under_virtualenv
|
|
|
|
|
@@ -354,6 +355,16 @@ def dist_in_site_packages(dist: Distribution) -> bool:
|
|
|
|
|
return dist_location(dist).startswith(normalize_path(site_packages))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -132,9 +133,9 @@ index 99ebea3..5901687 100644
|
|
|
|
|
+ get_scheme("").purelib.split('python')[0]))
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
def dist_is_editable(dist):
|
|
|
|
|
# type: (Distribution) -> bool
|
|
|
|
|
"""
|
|
|
|
|
def get_distribution(req_name: str) -> Optional[Distribution]:
|
|
|
|
|
"""Given a requirement name, return the installed Distribution object.
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
2.32.0
|
|
|
|
|
2.44.0
|
|
|
|
|
|
|
|
|
|