Blame SOURCES/pip-nowarn-upgrade.patch

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