1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
From: Scott Kitterman <scott@kitterman.com>
Date: Sun, 20 Jun 2021 13:49:30 -0400
Subject: Update base embed to include pip provided wheels for --no-download
Generate wheel lists and attributes for base install to match pip wheel
versions and add pkg_resources to the base install for no download.
Origin: vendor
Forwarded: not-needed
Last-Update: 2020-07-15
---
src/virtualenv/seed/wheels/embed/__init__.py | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/virtualenv/seed/wheels/embed/__init__.py b/src/virtualenv/seed/wheels/embed/__init__.py
index 5e51179..75b7b1a 100644
--- a/src/virtualenv/seed/wheels/embed/__init__.py
+++ b/src/virtualenv/seed/wheels/embed/__init__.py
@@ -39,6 +39,27 @@ BUNDLE_SUPPORT = {
MAX = "3.8"
+# Debian specific: Update BUNDLE_SUPPORT to match pip wheels shipped in
+# /usr/share/python-wheels for base install + pkg_resources.
+def list_available_wheels(versions):
+ import os
+ bundle = {version: {} for version in versions}
+ wheel_files = [Wheel.from_path(BUNDLE_FOLDER / fn)
+ for fn in os.listdir(BUNDLE_FOLDER)]
+ # Sort wheels so the latest compatible version wins
+ wheel_files.sort(key=lambda wheel: wheel.version_tuple)
+ for wheel in wheel_files:
+ if wheel.distribution in ['pip', 'setuptools', 'wheel']:
+ for version in versions:
+ if wheel.support_py(version):
+ bundle[version][wheel.distribution] = wheel.name
+ return bundle
+
+
+BUNDLE_SUPPORT = list_available_wheels(BUNDLE_SUPPORT.keys())
+# End Debian specific
+
+
def get_embed_wheel(distribution, for_py_version):
mapping = BUNDLE_SUPPORT.get(for_py_version, {}) or BUNDLE_SUPPORT[MAX]
wheel_file = mapping.get(distribution)
|