From 5cc394ff5c13e8c13289efee3428eff799de7e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 5 Apr 2024 15:49:47 +0200 Subject: [PATCH] When getting wheels for /usr/bin/python3 interpreter, look for them in proper directories - Fixes: rhbz#2272958 Up until now, when creating virtual environments for old Pythons (such as 3.6 or 2.7), the wheels were searched in the directories specific for the target Python version. As a result, old pip for old Python (e.g. pip 18.1 for Python 3.6) was run with the system Python (e.g. 3.12), which could lead to crashes, because the code in old pip was not compatible yet with newer Pythons. For details, see https://bugzilla.redhat.com/2272958 --- rpm-wheels.patch | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/rpm-wheels.patch b/rpm-wheels.patch index 61e6a88..5f6e50f 100644 --- a/rpm-wheels.patch +++ b/rpm-wheels.patch @@ -1,16 +1,21 @@ -From 19ebd526eacab84dfb3e432e968125ec95f95e89 Mon Sep 17 00:00:00 2001 +From 915453288bf883c912f2b31bc654ed24e0382a0f Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Thu, 27 Oct 2022 11:50:54 +0200 Subject: [PATCH] RPM wheels +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Co-Authored-By: Miro HronĨok --- src/virtualenv/run/__init__.py | 5 ++-- src/virtualenv/seed/embed/base_embed.py | 16 ++++++++++- src/virtualenv/seed/embed/pip_invoke.py | 1 + .../seed/embed/via_app_data/via_app_data.py | 1 + + src/virtualenv/seed/wheels/acquire.py | 3 ++- src/virtualenv/seed/wheels/embed/__init__.py | 3 +++ src/virtualenv/util/path/_system_wheels.py | 27 +++++++++++++++++++ - 6 files changed, 50 insertions(+), 3 deletions(-) + 7 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 src/virtualenv/util/path/_system_wheels.py diff --git a/src/virtualenv/run/__init__.py b/src/virtualenv/run/__init__.py @@ -95,8 +100,28 @@ index f31ecf6..d7a0f5a 100644 with self._get_seed_wheels(creator) as name_to_whl: pip_version = name_to_whl["pip"].version_tuple if "pip" in name_to_whl else None installer_class = self.installer_class(pip_version) +diff --git a/src/virtualenv/seed/wheels/acquire.py b/src/virtualenv/seed/wheels/acquire.py +index 21fde34..d6ae171 100644 +--- a/src/virtualenv/seed/wheels/acquire.py ++++ b/src/virtualenv/seed/wheels/acquire.py +@@ -97,13 +97,14 @@ def find_compatible_in_house(distribution, version_spec, for_py_version, in_fold + + + def pip_wheel_env_run(search_dirs, app_data, env): ++ from virtualenv.util.path._system_wheels import get_system_wheels_paths + env = env.copy() + env.update({"PIP_USE_WHEEL": "1", "PIP_USER": "0", "PIP_NO_INPUT": "1"}) + wheel = get_wheel( + distribution="pip", + version=None, + for_py_version=f"{sys.version_info.major}.{sys.version_info.minor}", +- search_dirs=search_dirs, ++ search_dirs=get_system_wheels_paths(sys), + download=False, + app_data=app_data, + do_periodic_update=False, diff --git a/src/virtualenv/seed/wheels/embed/__init__.py b/src/virtualenv/seed/wheels/embed/__init__.py -index f779e07..806fff3 100644 +index 782051a..71ec712 100644 --- a/src/virtualenv/seed/wheels/embed/__init__.py +++ b/src/virtualenv/seed/wheels/embed/__init__.py @@ -52,8 +52,11 @@ BUNDLE_SUPPORT = { @@ -145,5 +170,5 @@ index 0000000..fc7e942 + if wheels_dir.exists(): + yield wheels_dir -- -2.39.1 +2.44.0