Skip to content

Commit

Permalink
Merge pull request #11318 from q0w/check-binary-exe
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr authored Aug 31, 2022
2 parents 57c9f62 + 6354192 commit 0930237
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions news/11309.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ensure that the candidate ``pip`` executable exists, when checking for a new version of pip.
11 changes: 8 additions & 3 deletions src/pip/_internal/utils/entrypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@ def get_best_invocation_for_this_pip() -> str:
if exe_are_in_PATH:
for exe_name in _EXECUTABLE_NAMES:
found_executable = shutil.which(exe_name)
if found_executable and os.path.samefile(
found_executable,
os.path.join(binary_prefix, exe_name),
binary_executable = os.path.join(binary_prefix, exe_name)
if (
found_executable
and os.path.exists(binary_executable)
and os.path.samefile(
found_executable,
binary_executable,
)
):
return exe_name

Expand Down

0 comments on commit 0930237

Please sign in to comment.