diff --git a/news/271a34fa-97be-4ab4-afcf-e755f3fffdf9.trivial b/news/271a34fa-97be-4ab4-afcf-e755f3fffdf9.trivial new file mode 100644 index 000000000..e69de29bb diff --git a/src/pip/_internal/utils/outdated.py b/src/pip/_internal/utils/outdated.py index 8c3b50b98..2b3fa95e3 100644 --- a/src/pip/_internal/utils/outdated.py +++ b/src/pip/_internal/utils/outdated.py @@ -58,14 +58,14 @@ class SelfCheckState(object): separators=(",", ":")) -def pip_installed_by_pip(): - """Checks whether pip was installed by pip +def was_installed_by_pip(pkg): + """Checks whether pkg was installed by pip This is used not to display the upgrade message when pip is in fact installed by system package manager, such as dnf on Fedora. """ try: - dist = pkg_resources.get_distribution('pip') + dist = pkg_resources.get_distribution(pkg) return (dist.has_metadata('INSTALLER') and 'pip' in dist.get_metadata_lines('INSTALLER')) except pkg_resources.DistributionNotFound: @@ -125,7 +125,7 @@ def pip_version_check(session, options): # Determine if our pypi_version is older if (pip_version < remote_version and pip_version.base_version != remote_version.base_version and - pip_installed_by_pip()): + was_installed_by_pip('pip')): # Advise "python -m pip" on Windows to avoid issues # with overwriting pip.exe. if WINDOWS: