Skip to content

Commit

Permalink
Add an early return with comment if pip wasn't installed by pip
Browse files Browse the repository at this point in the history
This addresses a review comment around the code style, and makes it
possible to provide additonal context in the comment.
  • Loading branch information
pradyunsg committed Apr 22, 2022
1 parent 72ba4e7 commit a067d72
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/pip/_internal/self_outdated_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,12 @@ def _self_version_check_logic(

pip_installed_by_pip = was_installed_by_pip("pip")
logger.debug("Was pip installed by pip? %s", pip_installed_by_pip)
if not pip_installed_by_pip:
return None # Only suggest upgrade if pip is installed by pip.

local_version_is_older = (
local_version < remote_version
and local_version.base_version != remote_version.base_version
and pip_installed_by_pip
)
if local_version_is_older:
return UpgradePrompt(old=str(local_version), new=remote_version_str)
Expand Down

0 comments on commit a067d72

Please sign in to comment.