|
|
bd5b0e |
diff --git a/pip/utils/outdated.py b/pip/utils/outdated.py
|
|
|
bd5b0e |
index 2164cc3..c71539f 100644
|
|
|
bd5b0e |
--- a/pip/utils/outdated.py
|
|
|
bd5b0e |
+++ b/pip/utils/outdated.py
|
|
|
bd5b0e |
@@ -92,6 +92,21 @@ def load_selfcheck_statefile():
|
|
|
bd5b0e |
return GlobalSelfCheckState()
|
|
|
bd5b0e |
|
|
|
bd5b0e |
|
|
|
bd5b0e |
+def pip_installed_by_pip():
|
|
|
bd5b0e |
+ """Checks whether pip was installed by pip
|
|
|
bd5b0e |
+
|
|
|
bd5b0e |
+ This is used not to display the upgrade message when pip is in fact
|
|
|
bd5b0e |
+ installed by system package manager, such as dnf on Fedora.
|
|
|
bd5b0e |
+ """
|
|
|
bd5b0e |
+ import pkg_resources
|
|
|
bd5b0e |
+ try:
|
|
|
bd5b0e |
+ dist = pkg_resources.get_distribution('pip')
|
|
|
bd5b0e |
+ return (dist.has_metadata('INSTALLER') and
|
|
|
bd5b0e |
+ 'pip' in dist.get_metadata_lines('INSTALLER'))
|
|
|
bd5b0e |
+ except pkg_resources.DistributionNotFound:
|
|
|
bd5b0e |
+ return False
|
|
|
bd5b0e |
+
|
|
|
bd5b0e |
+
|
|
|
bd5b0e |
def pip_version_check(session):
|
|
|
bd5b0e |
"""Check for an update for pip.
|
|
|
bd5b0e |
|
|
|
bd5b0e |
@@ -141,7 +156,8 @@ def pip_version_check(session):
|
|
|
bd5b0e |
|
|
|
bd5b0e |
# Determine if our pypi_version is older
|
|
|
bd5b0e |
if (pip_version < remote_version and
|
|
|
bd5b0e |
- pip_version.base_version != remote_version.base_version):
|
|
|
bd5b0e |
+ pip_version.base_version != remote_version.base_version and
|
|
|
bd5b0e |
+ pip_installed_by_pip()):
|
|
|
bd5b0e |
# Advise "python -m pip" on Windows to avoid issues
|
|
|
bd5b0e |
# with overwriting pip.exe.
|
|
|
bd5b0e |
if WINDOWS:
|