python-pip/11318.patch
Miro Hrončok 14cce5a894 Fix logging crash when /usr/bin/pip3 is missing
Resolves: rhbz#2143799
2022-11-21 14:01:31 +01:00

66 lines
2.4 KiB
Diff

From 278141678e8bac4633a0589db83f13e17ebae6d7 Mon Sep 17 00:00:00 2001
From: q0w <43147888+q0w@users.noreply.github.com>
Date: Thu, 28 Jul 2022 07:36:02 +0300
Subject: [PATCH 1/3] Check if binary_executable exists
---
src/pip/_internal/utils/entrypoints.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/pip/_internal/utils/entrypoints.py b/src/pip/_internal/utils/entrypoints.py
index f292c64045b..15013693854 100644
--- a/src/pip/_internal/utils/entrypoints.py
+++ b/src/pip/_internal/utils/entrypoints.py
@@ -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
From 0f8243ff5e81d8f905422613ea9c0f45b120b84d Mon Sep 17 00:00:00 2001
From: q0w <43147888+q0w@users.noreply.github.com>
Date: Thu, 28 Jul 2022 14:23:38 +0300
Subject: [PATCH 2/3] Add news
---
news/11309.bugfix.rst | 1 +
1 file changed, 1 insertion(+)
create mode 100644 news/11309.bugfix.rst
diff --git a/news/11309.bugfix.rst b/news/11309.bugfix.rst
new file mode 100644
index 00000000000..f59d2516eee
--- /dev/null
+++ b/news/11309.bugfix.rst
@@ -0,0 +1 @@
+Ensure that a binary executable of pip exists when checking for a new version of pip.
From 6354192e2ef4ab19db5ba324dfd1ef4e2c840e07 Mon Sep 17 00:00:00 2001
From: q0w <43147888+q0w@users.noreply.github.com>
Date: Mon, 1 Aug 2022 14:28:59 +0300
Subject: [PATCH 3/3] Fix news
---
news/11309.bugfix.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/news/11309.bugfix.rst b/news/11309.bugfix.rst
index f59d2516eee..9ee54057da4 100644
--- a/news/11309.bugfix.rst
+++ b/news/11309.bugfix.rst
@@ -1 +1 @@
-Ensure that a binary executable of pip exists when checking for a new version of pip.
+Ensure that the candidate ``pip`` executable exists, when checking for a new version of pip.