From 468118fcf55abf1fd4927ad0ab0b48bbb25c0a3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Sat, 22 Jun 2024 14:28:23 +0200 Subject: [PATCH] [Gentoo] Use ensurepip wheels instead of local bundle --- src/virtualenv/seed/wheels/embed/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/virtualenv/seed/wheels/embed/__init__.py b/src/virtualenv/seed/wheels/embed/__init__.py index 102ed8e..66ba52b 100644 --- a/src/virtualenv/seed/wheels/embed/__init__.py +++ b/src/virtualenv/seed/wheels/embed/__init__.py @@ -1,5 +1,6 @@ from __future__ import annotations +import sysconfig from pathlib import Path from virtualenv.seed.wheels.util import Wheel @@ -51,6 +52,13 @@ MAX = "3.7" def get_embed_wheel(distribution, for_py_version): + # Gentoo hack: get wheel from ensurepip directory + bundle_dir = Path(sysconfig.get_config_var("WHEEL_PKG_DIR")) + try: + return Wheel.from_path(next(bundle_dir.glob(f"{distribution}-*.whl"))) + except StopIteration: + return None + path = BUNDLE_FOLDER / (BUNDLE_SUPPORT.get(for_py_version, {}) or BUNDLE_SUPPORT[MAX]).get(distribution) return Wheel.from_path(path) -- 2.45.2