Blame SOURCES/pip-nowarn-upgrade.patch

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