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