gentoo/dev-python/virtualenv/files/virtualenv-20.26.3-ensurepip.patch
Michał Górny 45ad79bd01
dev-python/virtualenv: Use ensurepip instead of bundled wheels
Closes: https://bugs.gentoo.org/807643
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2024-06-22 14:43:26 +02:00

38 lines
1.2 KiB
Diff

From 468118fcf55abf1fd4927ad0ab0b48bbb25c0a3c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
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