Blame SOURCES/pip-nowarn-upgrade.patch

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