Blame SOURCES/pip-nowarn-upgrade.patch

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