Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Miro Hrončok
14cce5a894 Fix logging crash when /usr/bin/pip3 is missing
Resolves: rhbz#2143799
2022-11-21 14:01:31 +01:00
2 changed files with 76 additions and 1 deletions

66
11318.patch Normal file
View file

@ -0,0 +1,66 @@
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.

View file

@ -21,7 +21,7 @@
Name: python-%{srcname}
Version: %{base_version}%{?prerel:~%{prerel}}
Release: 2%{?dist}
Release: 3%{?dist}
Summary: A tool for installing and managing Python packages
# We bundle a lot of libraries with pip, which itself is under MIT license.
@ -94,6 +94,11 @@ Patch: no-version-warning.patch
# Resolved upstream: https://github.com/pypa/pip/pull/11353
Patch: bad-metadata-fix.patch
# Check if binary_executable exists before checking it is identical to the other one
# pip update warning had a logging error when /usr/bin/pip3 did not exist and pip3 existed on $PATH
# This is a fix from pip 22.3
Patch: https://github.com/pypa/pip/pull/11318.patch
# Downstream only patch
# Users might have local installations of pip from using
# `pip install --user --upgrade pip` on older/newer versions.
@ -406,6 +411,10 @@ pytest_k='not completion and
%{python_wheel_dir}/%{python_wheel_name}
%changelog
* Mon Nov 21 2022 Miro Hrončok <mhroncok@redhat.com> - 22.2.2-3
- Fix logging crash when /usr/bin/pip3 is missing
Resolves: rhbz#2143799
* Mon Sep 05 2022 Python Maint <python-maint@redhat.com> - 22.2.2-2
- Fix crash when an empty dist-info/egg-info is present
Resolves: rhbz#2115001