update version 20.2.2 for LTS

This commit is contained in:
zhanliwen 2020-08-28 14:27:52 +08:00 committed by 19909236985
parent bd7fa563d2
commit 40eb39a71c
9 changed files with 226 additions and 227 deletions

View File

@ -1,89 +1,31 @@
diff -ru pip-18.0/src/pip/_internal/commands/install.py pip-18.0_patched/src/pip/_internal/commands/install.py From e2126b5d4efdbddb15a3c354110055f40d78f4cc Mon Sep 17 00:00:00 2001
--- pip-18.0/src/pip/_internal/commands/install.py 2018-07-20 06:10:48.000000000 +0200 From: wwx930846 <wuchaochao4@huawei.com>
+++ pip-18.0_patched/src/pip/_internal/commands/install.py 2018-07-23 16:49:39.085357813 +0200 Date: Mon, 24 Aug 2020 22:01:50 +0800
@@ -110,6 +110,14 @@ Subject: [PATCH] allow-stripping-given-prefix-from-wheel-RECORD-files
---
src/pip/_internal/commands/install.py | 8 ++++++++
src/pip/_internal/req/req_install.py | 4 +++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py
index 8c2c32f..674d30c 100644
--- a/src/pip/_internal/commands/install.py
+++ b/src/pip/_internal/commands/install.py
@@ -130,6 +130,13 @@ class InstallCommand(RequirementCommand):
default=None, default=None,
help="Installation prefix where lib, bin and other top-level " help="Installation prefix where lib, bin and other top-level "
"folders are placed") "folders are placed")
+ cmd_opts.add_option( + self.cmd_opts.add_option(
+ '--strip-file-prefix', + '--strip-file-prefix',
+ dest='strip_file_prefix', + dest='strip_file_prefix',
+ metavar='prefix', + metavar='prefix',
+ default=None, + default=None,
+ help="Strip given prefix from script paths in wheel RECORD." + help="Strip given prefix from script paths in wheel RECORD."
+ ) + )
+
cmd_opts.add_option(cmdoptions.build_dir()) self.cmd_opts.add_option(cmdoptions.build_dir())
@@ -345,6 +353,7 @@
pycompile=options.compile,
warn_script_location=warn_script_location,
use_user_site=options.use_user_site,
+ strip_file_prefix=options.strip_file_prefix,
)
lib_locations = get_lib_location_guesses( 2.23.0
diff -ru pip-18.0/src/pip/_internal/req/req_install.py pip-18.0_patched/src/pip/_internal/req/req_install.py
--- pip-18.0/src/pip/_internal/req/req_install.py 2018-07-22 07:14:20.000000000 +0200
+++ pip-18.0_patched/src/pip/_internal/req/req_install.py 2018-07-23 16:51:51.115943214 +0200
@@ -514,7 +514,7 @@
def move_wheel_files(self, wheeldir, root=None, home=None, prefix=None,
warn_script_location=True, use_user_site=False,
- pycompile=True):
+ pycompile=True, strip_file_prefix=None):
move_wheel_files(
self.name, self.req, wheeldir,
user=use_user_site,
@@ -524,6 +524,7 @@
pycompile=pycompile,
isolated=self.isolated,
warn_script_location=warn_script_location,
+ strip_file_prefix=strip_file_prefix,
)
# Things valid for sdists
@@ -924,7 +925,7 @@
def install(self, install_options, global_options=None, root=None,
home=None, prefix=None, warn_script_location=True,
- use_user_site=False, pycompile=True):
+ use_user_site=False, pycompile=True, strip_file_prefix=None):
global_options = global_options if global_options is not None else []
if self.editable:
self.install_editable(
@@ -939,6 +940,7 @@
self.source_dir, root=root, prefix=prefix, home=home,
warn_script_location=warn_script_location,
use_user_site=use_user_site, pycompile=pycompile,
+ strip_file_prefix=strip_file_prefix,
)
self.install_succeeded = True
return
diff -ru pip-18.0/src/pip/_internal/wheel.py pip-18.0_patched/src/pip/_internal/wheel.py
--- pip-18.0/src/pip/_internal/wheel.py 2018-07-17 10:26:00.000000000 +0200
+++ pip-18.0_patched/src/pip/_internal/wheel.py 2018-07-23 16:52:57.749238655 +0200
@@ -206,7 +206,7 @@
def move_wheel_files(name, req, wheeldir, user=False, home=None, root=None,
pycompile=True, scheme=None, isolated=False, prefix=None,
- warn_script_location=True):
+ warn_script_location=True, strip_file_prefix=None):
"""Install a wheel"""
if not scheme:
@@ -507,7 +507,12 @@
writer.writerow(row)
for f in generated:
digest, length = rehash(f)
- writer.writerow((normpath(f, lib_dir), digest, length))
+ final_path = normpath(f, lib_dir)
+ if strip_file_prefix and final_path.startswith(strip_file_prefix):
+ final_path = os.path.join(os.sep,
+ os.path.relpath(final_path, strip_file_prefix))
+ writer.writerow((final_path, digest, length))
+
for f in installed:
writer.writerow((installed[f], '', ''))
shutil.move(temp_record, record)

View File

@ -1,15 +1,27 @@
From 09bf87d33141a5c06a1d410839d162262baa16c4 Mon Sep 17 00:00:00 2001
From: Tomas Hrnciar <thrnciar@redhat.com>
Date: Sun, 26 Apr 2020 21:38:44 +0200
Subject: [PATCH] Dummy certifi patch
---
src/pip/_vendor/certifi/core.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/pip/_vendor/certifi/core.py b/src/pip/_vendor/certifi/core.py diff --git a/src/pip/_vendor/certifi/core.py b/src/pip/_vendor/certifi/core.py
index eab9d1d..30db215 100644 index 8987449..128fa92 100644
--- a/src/pip/_vendor/certifi/core.py --- a/src/pip/_vendor/certifi/core.py
+++ b/src/pip/_vendor/certifi/core.py +++ b/src/pip/_vendor/certifi/core.py
@@ -19,9 +19,7 @@ class DeprecatedBundleWarning(DeprecationWarning): @@ -51,9 +51,7 @@ except ImportError:
# If we don't have importlib.resources, then we will just do the old logic
# of assuming we're on the filesystem and munge the path directly.
def where(): def where():
- f = os.path.dirname(__file__) - f = os.path.dirname(__file__)
- -
- return os.path.join(f, 'cacert.pem') - return os.path.join(f, "cacert.pem")
+ return '/etc/pki/tls/certs/ca-bundle.crt' + return '/etc/pki/tls/certs/ca-bundle.crt'
def old_where(): def contents():
--
2.23.0

View File

@ -1,31 +1,51 @@
diff -ru pip-18.0/src/pip/_internal/commands/install.py pip-18.0_patched/src/pip/_internal/commands/install.py From 74bb5d26e232493de43adfa1f4b42b66fd701294 Mon Sep 17 00:00:00 2001
--- pip-18.0/src/pip/_internal/commands/install.py 2018-07-20 06:10:48.000000000 +0200 From: Tomas Hrnciar <thrnciar@redhat.com>
+++ pip-18.0_patched/src/pip/_internal/commands/install.py 2018-07-31 12:15:43.777317780 +0200 Date: Sun, 26 Apr 2020 13:52:24 +0200
@@ -5,6 +5,8 @@ Subject: [PATCH] Downstream only patch
import operator
Emit a warning to the user if pip install is run with root privileges
Issue upstream: https://github.com/pypa/pip/issues/4288
---
src/pip/_internal/commands/install.py | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py
index 70bda2e2..1e750ae1 100644
--- a/src/pip/_internal/commands/install.py
+++ b/src/pip/_internal/commands/install.py
@@ -13,6 +13,8 @@ import operator
import os import os
import shutil import shutil
import site
+import sys +import sys
+from os import path +from os import path
from optparse import SUPPRESS_HELP from optparse import SUPPRESS_HELP
from pip._vendor import pkg_resources from pip._vendor import pkg_resources
@@ -205,6 +207,18 @@ @@ -241,6 +243,23 @@ class InstallCommand(RequirementCommand):
def run(self, options, args): raise CommandError("Can not combine '--user' and '--target'")
cmdoptions.check_install_build_global(options)
cmdoptions.check_install_build_global(options)
+
+ def is_venv(): + def is_venv():
+ return hasattr(sys, 'real_prefix') or \ + return (hasattr(sys, 'real_prefix') or
+ (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix) + (hasattr(sys, 'base_prefix') and
+ sys.base_prefix != sys.prefix))
+ +
+ # Check whether we have root privileges and aren't in venv/virtualenv + # Check whether we have root privileges and aren't in venv/virtualenv
+ if os.getuid() == 0 and not is_venv(): + if os.getuid() == 0 and not is_venv() and not options.root_path:
+ command = path.basename(sys.argv[0])
+ if command == "__main__.py":
+ command = path.basename(sys.executable) + " -m pip"
+ logger.warning( + logger.warning(
+ "WARNING: Running pip install with root privileges is " + "Running pip install with root privileges is "
+ "generally not a good idea. Try `%s install --user` instead." + "generally not a good idea. Try `%s install --user` instead."
+ % path.basename(sys.argv[0]) + % command
+ ) + )
+ +
upgrade_strategy = "to-satisfy-only" upgrade_strategy = "to-satisfy-only"
if options.upgrade: if options.upgrade:
upgrade_strategy = options.upgrade_strategy upgrade_strategy = options.upgrade_strategy
--
2.23.0

Binary file not shown.

BIN
pip-20.2.2.tar.gz Normal file

Binary file not shown.

View File

@ -1,16 +1,27 @@
--- /usr/bin/pip3 2018-03-29 15:22:13.000000000 +0200 --- /usr/bin/pip3 2019-11-12 17:37:34.793131862 +0100
+++ pip3 2018-05-04 11:49:08.098821010 +0200 +++ pip3 2019-11-12 17:40:42.014107134 +0100
@@ -4,7 +4,12 @@ @@ -2,7 +2,23 @@
# -*- coding: utf-8 -*-
import re import re
import sys import sys
-from pip._internal.cli.main import main
-from pip._internal import main +
+try: +try:
+ from pip._internal import main + from pip._internal.cli.main import main
+except ImportError: +except ImportError:
+ # user has most probably downgraded pip in their home + try:
+ # so let them run it anyway until ~/.local/bin makes it in front of the PATH + from pip._internal.main import main
+ from pip import main + except ImportError:
+ try:
+ # If the user has downgraded pip, the above import will fail.
+ # Let's try older methods of invoking it:
+
+ # pip 19 uses this
+ from pip._internal import main
+ except ImportError:
+ # older pip versions use this
+ from pip import main
+
if __name__ == '__main__': if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

View File

@ -6,18 +6,18 @@
pip is the package installer for Python. You can use pip to install packages from the Python Package Index and other indexes. pip is the package installer for Python. You can use pip to install packages from the Python Package Index and other indexes.
%global bashcompdir %(b=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null); echo ${b:-%{_sysconfdir}/bash_completion.d}) %global bashcompdir %(b=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null); echo ${b:-%{_sysconfdir}/bash_completion.d})
Name: python-%{srcname} Name: python-%{srcname}
Version: 18.0 Version: 20.2.2
Release: 12 Release: 1
Summary: A tool for installing and managing Python packages Summary: A tool for installing and managing Python packages
License: MIT and Python and ASL 2.0 and BSD and ISC and LGPLv2 and MPLv2.0 and (ASL 2.0 or BSD) License: MIT and Python and ASL 2.0 and BSD and ISC and LGPLv2 and MPLv2.0 and (ASL 2.0 or BSD)
URL: http://www.pip-installer.org URL: http://www.pip-installer.org
Source0: https://files.pythonhosted.org/packages/source/p/%{srcname}/%{srcname}-%{version}.tar.gz Source0: https://files.pythonhosted.org/packages/source/p/%{srcname}/%{srcname}-%{version}.tar.gz
BuildArch: noarch BuildArch: noarch
Patch0: allow-stripping-given-prefix-from-wheel-RECORD-files.patch Patch1: allow-stripping-given-prefix-from-wheel-RECORD-files.patch
Patch1: remove-existing-dist-only-if-path-conflicts.patch
Patch2: emit-a-warning-when-running-with-root-privileges.patch Patch2: emit-a-warning-when-running-with-root-privileges.patch
Patch3: remove-existing-dist-only-if-path-conflicts.patch
Patch6000: dummy-certifi.patch Patch6000: dummy-certifi.patch
Source1: pip-allow-older-versions.patch Source1: pip-allow-older-versions.patch
%description %{_description} %description %{_description}
@ -59,56 +59,62 @@ A Python wheel of pip to use with venv
%py3_build_wheel %py3_build_wheel
%install %install
%py3_install_wheel %{python_wheelname} %{__python3} dist/%{python_wheelname}/pip install \
--root %{buildroot} \
--no-deps \
--no-cache-dir \
--no-index \
--ignore-installed \
--find-links dist \
'pip==%{version}'
rm %{buildroot}%{_bindir}/pip rm %{buildroot}%{_bindir}/pip
%if %{with python2} %if %{with python2}
%py2_install_wheel %{python_wheelname} %{__python2} dist/%{python_wheelname}/pip install \
--root %{buildroot} \
--no-deps \
--no-cache-dir \
--no-index \
--ignore-installed \
--find-links dist \
'pip==%{version}'
%endif %endif
%if %{with doc}
pushd docs/build/man
install -d %{buildroot}%{_mandir}/man1
for MAN in *1; do
install -pm0644 $MAN %{buildroot}%{_mandir}/man1/$MAN
for pip in "pip3" "pip-3" "pip%{python3_version}" "pip-%{python3_version}"; do
echo ".so $MAN" > %{buildroot}%{_mandir}/man1/${MAN/pip/$pip}
done
done
popd
%endif
# before we ln -s anything, we apply Source10 patch to all pips:
for PIP in %{buildroot}%{_bindir}/pip*; do for PIP in %{buildroot}%{_bindir}/pip*; do
patch -p1 $PIP < %{SOURCE1} patch -p1 $PIP < %{SOURCE1}
done done
mkdir -p %{buildroot}%{bashcompdir} mkdir -p %{buildroot}%{bashcompdir}
%if %{with python2}
PYTHONPATH=%{buildroot}%{python2_sitelib} \
%{buildroot}%{_bindir}/pip completion --bash \
> %{buildroot}%{bashcompdir}/pip
%endif
PYTHONPATH=%{buildroot}%{python3_sitelib} \ PYTHONPATH=%{buildroot}%{python3_sitelib} \
%{buildroot}%{_bindir}/pip3 completion --bash \ %{buildroot}%{_bindir}/pip completion --bash \
> %{buildroot}%{bashcompdir}/pip3 > %{buildroot}%{bashcompdir}/pip3
pips2=pip
pips3=pip3 # Make bash completion apply to all the 5 symlinks we install
for pip in %{buildroot}%{_bindir}/pip*; do sed -i -e "s/^\\(complete.*\\) pip\$/\\1 pip pip{,-}{3,%{python3_version}}/" \
pip=$(basename $pip)
case $pip in
%if %{with python2}
pip2*)
pips2="$pips2 $pip"
ln -s pip %{buildroot}%{bashcompdir}/$pip
;;
%endif
pip3?*)
pips3="$pips3 $pip"
ln -s pip3 %{buildroot}%{bashcompdir}/$pip
;;
esac
done
sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips3/" \
-e s/_pip_completion/_pip3_completion/ \ -e s/_pip_completion/_pip3_completion/ \
%{buildroot}%{bashcompdir}/pip3 %{buildroot}%{bashcompdir}/pip3
%if %{with python2} # Provide symlinks to executables to comply with Fedora guidelines for Python
sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips2/" \ ln -s ./pip%{python3_version} %{buildroot}%{_bindir}/pip-%{python3_version}
%{buildroot}%{bashcompdir}/pip ln -s ./pip-%{python3_version} %{buildroot}%{_bindir}/pip-3
%endif
%if %{with python2} # Make sure the INSTALLER is not pip, otherwise Patch2 won't work
echo rpm > %{buildroot}%{python2_sitelib}/pip-%{version}.dist-info/INSTALLER # %%pyproject macros do this for all packages
%endif echo rpm > %{buildroot}%{python3_sitelib}/pip-20.2.2.dist-info/INSTALLER
echo rpm > %{buildroot}%{python3_sitelib}/pip-%{version}.dist-info/INSTALLER
mkdir -p %{buildroot}%{python_wheeldir} mkdir -p %{buildroot}%{python_wheeldir}
install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir} install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir}
@ -121,14 +127,13 @@ install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir}
%{_bindir}/pip%{python2_version} %{_bindir}/pip%{python2_version}
%{python2_sitelib}/pip* %{python2_sitelib}/pip*
%dir %{bashcompdir} %dir %{bashcompdir}
%{bashcompdir}/pip
%{bashcompdir}/pip2*
%dir %(dirname %{bashcompdir}) %dir %(dirname %{bashcompdir})
%endif %endif
%files -n python%{python3_pkgversion}-%{srcname} %files -n python%{python3_pkgversion}-%{srcname}
%license LICENSE.txt %license LICENSE.txt
%{_bindir}/pip3 %{_bindir}/pip3
%{_bindir}/pip-3*
%{_bindir}/pip%{python3_version} %{_bindir}/pip%{python3_version}
%{python3_sitelib}/pip* %{python3_sitelib}/pip*
%dir %{bashcompdir} %dir %{bashcompdir}
@ -144,6 +149,9 @@ install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir}
%{python_wheeldir}/%{python_wheelname} %{python_wheeldir}/%{python_wheelname}
%changelog %changelog
* Mon Aug 31 2020 wenzhanli<wenzhanli2@huawei.com> - 20.2.2-1
- update to 20.2.2
* Thu Feb 20 2020 chengquan3<chengquan3@huawei.com> - 18.0-12 * Thu Feb 20 2020 chengquan3<chengquan3@huawei.com> - 18.0-12
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA

4
python-pip.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: pypi
src_repo: pip
tag_prefix: ^v
seperator: .

View File

@ -1,77 +1,78 @@
commit b6d5da6796801862eb751a93d507c343af0604d6 From d381c59fdc15949c4dc293bd92bbccb60289a703 Mon Sep 17 00:00:00 2001
Author: Victor Stinner <vstinner@redhat.com> From: Tomas Hrnciar <thrnciar@redhat.com>
Date: Tue Sep 18 17:13:51 2018 +0200 Date: Sun, 26 Apr 2020 21:19:03 +0200
Subject: [PATCH] Prevent removing of the system packages installed under
/usr/lib
Subject: Prevent removing of the system packages installed under /usr/lib when pip install -U is executed.
when pip install -U is executed. Resolves: rhbz#1550368
Resolves: rhbz#1550368 ---
src/pip/_internal/req/req_install.py | 3 ++-
Co-Authored-By: Michal Cyprian <m.cyprian@gmail.com> src/pip/_internal/resolution/legacy/resolver.py | 5 ++++-
src/pip/_internal/utils/misc.py | 9 +++++++++
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py
index 8e91ecb..9beb100 100644 index 4759f4a..2e76e35 100644
--- a/src/pip/_internal/req/req_install.py --- a/src/pip/_internal/req/req_install.py
+++ b/src/pip/_internal/req/req_install.py +++ b/src/pip/_internal/req/req_install.py
@@ -36,7 +36,7 @@ from pip._internal.utils.hashes import Hashes @@ -39,6 +39,7 @@ from pip._internal.utils.misc import (
from pip._internal.utils.logging import indent_log ask_path_exists,
from pip._internal.utils.misc import ( backup_dir,
_make_build_dir, ask_path_exists, backup_dir, call_subprocess, display_path,
- display_path, dist_in_site_packages, dist_in_usersite, ensure_dir, + dist_in_install_path,
+ display_path, dist_in_install_path, dist_in_site_packages, dist_in_usersite, ensure_dir, dist_in_site_packages,
get_installed_version, is_installable_dir, read_text_file, rmtree, dist_in_usersite,
) get_distribution,
from pip._internal.utils.setuptools_build import SETUPTOOLS_SHIM @@ -446,7 +447,7 @@ class InstallRequirement(object):
@@ -503,7 +503,7 @@ class InstallRequirement(object): "lack sys.path precedence to {} in {}".format(
"lack sys.path precedence to %s in %s" % existing_dist.project_name, existing_dist.location)
(existing_dist.project_name, existing_dist.location)
) )
- else: - else:
+ elif dist_in_install_path(existing_dist): + elif dist_in_install_path(existing_dist):
self.conflicts_with = existing_dist self.should_reinstall = True
return True else:
if self.editable:
diff --git a/src/pip/_internal/resolve.py b/src/pip/_internal/resolve.py diff --git a/src/pip/_internal/resolution/legacy/resolver.py b/src/pip/_internal/resolution/legacy/resolver.py
index 8480e48..b118098 100644 index c9b4c66..8b98ebd 100644
--- a/src/pip/_internal/resolve.py --- a/src/pip/_internal/resolution/legacy/resolver.py
+++ b/src/pip/_internal/resolve.py +++ b/src/pip/_internal/resolution/legacy/resolver.py
@@ -20,7 +20,7 @@ from pip._internal.exceptions import ( @@ -34,6 +34,7 @@ from pip._internal.resolution.base import BaseResolver
) from pip._internal.utils.compatibility_tags import get_supported
from pip._internal.req.req_install import InstallRequirement
from pip._internal.utils.logging import indent_log from pip._internal.utils.logging import indent_log
-from pip._internal.utils.misc import dist_in_usersite, ensure_dir from pip._internal.utils.misc import dist_in_usersite, normalize_version_info
+from pip._internal.utils.misc import dist_in_install_path, dist_in_usersite, ensure_dir +from pip._internal.utils.misc import dist_in_install_path
from pip._internal.utils.packaging import check_dist_requires_python from pip._internal.utils.packaging import (
check_requires_python,
logger = logging.getLogger(__name__) get_requires_python,
@@ -123,7 +123,9 @@ class Resolver(object): @@ -207,7 +208,9 @@ class Resolver(BaseResolver):
""" """
# Don't uninstall the conflict if doing a user install and the # Don't uninstall the conflict if doing a user install and the
# conflict is not a user install. # conflict is not a user install.
- if not self.use_user_site or dist_in_usersite(req.satisfied_by): - if not self.use_user_site or dist_in_usersite(req.satisfied_by):
+ if ((not self.use_user_site + if ((not self.use_user_site
+ or dist_in_usersite(req.satisfied_by)) + or dist_in_usersite(req.satisfied_by))
+ and dist_in_install_path(req.satisfied_by)): + and dist_in_install_path(req.satisfied_by)):
req.conflicts_with = req.satisfied_by req.should_reinstall = True
req.satisfied_by = None req.satisfied_by = None
diff --git a/src/pip/_internal/utils/misc.py b/src/pip/_internal/utils/misc.py diff --git a/src/pip/_internal/utils/misc.py b/src/pip/_internal/utils/misc.py
index 3236af6..e60287b 100644 index 5629c60..6bd6daa 100644
--- a/src/pip/_internal/utils/misc.py --- a/src/pip/_internal/utils/misc.py
+++ b/src/pip/_internal/utils/misc.py +++ b/src/pip/_internal/utils/misc.py
@@ -32,7 +32,7 @@ from pip._internal.compat import ( @@ -31,6 +31,7 @@ from pip._vendor.six.moves.urllib.parse import unquote as urllib_unquote
from pip._internal.exceptions import CommandError, InstallationError from pip import __version__
from pip._internal.exceptions import CommandError
from pip._internal.locations import ( from pip._internal.locations import (
running_under_virtualenv, site_packages, user_site, virtualenv_no_global, + distutils_scheme,
- write_delete_marker_file, get_major_minor_version,
+ write_delete_marker_file, distutils_scheme, site_packages,
) user_site,
@@ -402,6 +403,14 @@ def dist_in_site_packages(dist):
if PY2: """
@@ -324,6 +324,16 @@ def dist_in_site_packages(dist): return dist_location(dist).startswith(normalize_path(site_packages))
).startswith(normalize_path(site_packages))
+def dist_in_install_path(dist): +def dist_in_install_path(dist):
+ """ + """
@ -81,8 +82,9 @@ index 3236af6..e60287b 100644
+ norm_path = normalize_path(dist_location(dist)) + norm_path = normalize_path(dist_location(dist))
+ return norm_path.startswith(normalize_path( + return norm_path.startswith(normalize_path(
+ distutils_scheme("")['purelib'].split('python')[0])) + distutils_scheme("")['purelib'].split('python')[0]))
+
+
def dist_is_editable(dist): def dist_is_editable(dist):
"""Is distribution an editable install?""" # type: (Distribution) -> bool
for path_item in sys.path: --
2.23.0