Blame SOURCES/pip-nowarn-upgrade.patch

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