Update to 20.0.23 (#1742034)
parent
3607f30fe3
commit
9aaabea1a7
@ -1,50 +1,187 @@
|
||||
diff --git a/virtualenv.py b/virtualenv.py
|
||||
index c7f71e6..3740014 100755
|
||||
--- a/virtualenv.py
|
||||
+++ b/virtualenv.py
|
||||
@@ -475,7 +475,18 @@ def virtualenv_support_dirs():
|
||||
|
||||
# normal filesystem installation
|
||||
if os.path.isdir(join(HERE, "virtualenv_support")):
|
||||
- yield [join(HERE, "virtualenv_support")]
|
||||
+ dirs = [join(HERE, "virtualenv_support")]
|
||||
+ if os.path.isdir("/usr/share/python-wheels"):
|
||||
+ dirs.insert(0, "/usr/share/python-wheels")
|
||||
From fd3e105dde6f4c14b4d85a325cd70c79d7b452cc Mon Sep 17 00:00:00 2001
|
||||
From: Lumir Balhar <lbalhar@redhat.com>
|
||||
Date: Fri, 22 May 2020 14:25:48 +0200
|
||||
Subject: [PATCH] rpm wheels
|
||||
|
||||
---
|
||||
src/virtualenv/seed/embed/base_embed.py | 5 ++++
|
||||
src/virtualenv/seed/embed/pip_invoke.py | 5 ++--
|
||||
src/virtualenv/seed/embed/wheels/__init__.py | 3 +++
|
||||
src/virtualenv/seed/embed/wheels/acquire.py | 24 ++++++++++++-------
|
||||
.../seed/via_app_data/via_app_data.py | 1 +
|
||||
src/virtualenv/util/path/_system_wheels.py | 22 +++++++++++++++++
|
||||
6 files changed, 49 insertions(+), 11 deletions(-)
|
||||
create mode 100644 src/virtualenv/util/path/_system_wheels.py
|
||||
|
||||
diff --git a/src/virtualenv/seed/embed/base_embed.py b/src/virtualenv/seed/embed/base_embed.py
|
||||
index bffd494..349e5ff 100644
|
||||
--- a/src/virtualenv/seed/embed/base_embed.py
|
||||
+++ b/src/virtualenv/seed/embed/base_embed.py
|
||||
@@ -6,6 +6,7 @@ from six import add_metaclass
|
||||
|
||||
from virtualenv.util.path import Path
|
||||
from virtualenv.util.six import ensure_str, ensure_text
|
||||
+from virtualenv.util.path._system_wheels import get_system_wheels_paths
|
||||
|
||||
from ..seeder import Seeder
|
||||
|
||||
@@ -101,3 +102,7 @@ class BaseEmbed(Seeder):
|
||||
|
||||
def __repr__(self):
|
||||
return ensure_str(self.__unicode__())
|
||||
+
|
||||
+ def insert_system_wheels_paths(self, creator):
|
||||
+ system_wheels_paths = get_system_wheels_paths(creator.interpreter.executable)
|
||||
+ self.extra_search_dir = list(system_wheels_paths) + self.extra_search_dir
|
||||
diff --git a/src/virtualenv/seed/embed/pip_invoke.py b/src/virtualenv/seed/embed/pip_invoke.py
|
||||
index 25be493..f49a420 100644
|
||||
--- a/src/virtualenv/seed/embed/pip_invoke.py
|
||||
+++ b/src/virtualenv/seed/embed/pip_invoke.py
|
||||
@@ -23,8 +23,9 @@ class PipInvoke(BaseEmbed):
|
||||
def run(self, creator):
|
||||
if not self.enabled:
|
||||
return
|
||||
+ self.insert_system_wheels_paths(creator)
|
||||
with self.get_pip_install_cmd(creator.exe, creator.interpreter.version_release_str) as cmd:
|
||||
- with pip_wheel_env_run(creator.interpreter.version_release_str, self.app_data) as env:
|
||||
+ with pip_wheel_env_run(creator.interpreter.version_release_str, creator.interpreter.executable, self.app_data) as env:
|
||||
self._execute(cmd, env)
|
||||
|
||||
@staticmethod
|
||||
@@ -46,8 +47,6 @@ class PipInvoke(BaseEmbed):
|
||||
cmd.append("{}{}".format(key, "=={}".format(ver) if ver is not None else ""))
|
||||
with ExitStack() as stack:
|
||||
folders = set()
|
||||
- for context in (ensure_file_on_disk(get_bundled_wheel(p, version), self.app_data) for p in pkg_versions):
|
||||
- folders.add(stack.enter_context(context).parent)
|
||||
folders.update(set(self.extra_search_dir))
|
||||
for folder in folders:
|
||||
cmd.extend(["--find-links", str(folder)])
|
||||
diff --git a/src/virtualenv/seed/embed/wheels/__init__.py b/src/virtualenv/seed/embed/wheels/__init__.py
|
||||
index 90fea02..99cc251 100644
|
||||
--- a/src/virtualenv/seed/embed/wheels/__init__.py
|
||||
+++ b/src/virtualenv/seed/embed/wheels/__init__.py
|
||||
@@ -38,3 +38,6 @@ BUNDLE_SUPPORT = {
|
||||
},
|
||||
}
|
||||
MAX = "3.9"
|
||||
+
|
||||
+# Redefined here because bundled wheels are removed in RPM build
|
||||
+BUNDLE_SUPPORT = None
|
||||
diff --git a/src/virtualenv/seed/embed/wheels/acquire.py b/src/virtualenv/seed/embed/wheels/acquire.py
|
||||
index 91b630d..4067f0e 100644
|
||||
--- a/src/virtualenv/seed/embed/wheels/acquire.py
|
||||
+++ b/src/virtualenv/seed/embed/wheels/acquire.py
|
||||
@@ -12,6 +12,7 @@ from zipfile import ZipFile
|
||||
|
||||
from virtualenv.info import IS_ZIPAPP
|
||||
from virtualenv.util.path import Path
|
||||
+from virtualenv.util.path._system_wheels import get_system_wheels_paths
|
||||
from virtualenv.util.six import ensure_str, ensure_text
|
||||
from virtualenv.util.subprocess import Popen, subprocess
|
||||
from virtualenv.util.zipapp import ensure_file_on_disk
|
||||
@@ -33,8 +34,9 @@ class WheelDownloadFail(ValueError):
|
||||
def get_wheels(for_py_version, wheel_cache_dir, extra_search_dir, packages, app_data, download):
|
||||
# not all wheels are compatible with all python versions, so we need to py version qualify it
|
||||
processed = copy(packages)
|
||||
- # 1. acquire from bundle
|
||||
- acquire_from_bundle(processed, for_py_version, wheel_cache_dir)
|
||||
+ # Do not use bundled wheels, they are removed in rpmbuild anyway
|
||||
+ # acquire_from_bundle(processed, for_py_version, wheel_cache_dir)
|
||||
+
|
||||
# 2. acquire from extra search dir
|
||||
acquire_from_dir(processed, for_py_version, wheel_cache_dir, extra_search_dir)
|
||||
# 3. download from the internet
|
||||
@@ -47,6 +49,7 @@ def get_wheels(for_py_version, wheel_cache_dir, extra_search_dir, packages, app_
|
||||
|
||||
|
||||
def acquire_from_bundle(packages, for_py_version, to_folder):
|
||||
+ raise NotImplementedError("Bundled wheels are not available")
|
||||
for pkg, version in list(packages.items()):
|
||||
bundle = get_bundled_wheel(pkg, for_py_version)
|
||||
if bundle is not None:
|
||||
@@ -67,6 +70,7 @@ def acquire_from_bundle(packages, for_py_version, to_folder):
|
||||
|
||||
|
||||
def get_bundled_wheel(package, version_release):
|
||||
+ raise NotImplementedError("Bundled wheels are not available") # and BUNDLE_SUPPORT == None anyway
|
||||
return BUNDLE_FOLDER / (BUNDLE_SUPPORT.get(version_release, {}) or BUNDLE_SUPPORT[MAX]).get(package)
|
||||
|
||||
|
||||
@@ -156,7 +160,7 @@ def download_wheel(packages, for_py_version, to_folder, app_data):
|
||||
cmd.extend(to_download)
|
||||
# pip has no interface in python - must be a new sub-process
|
||||
|
||||
- with pip_wheel_env_run("{}.{}".format(*sys.version_info[0:2]), app_data) as env:
|
||||
+ with pip_wheel_env_run("{}.{}".format(*sys.version_info[0:2]), sys.executable, app_data) as env:
|
||||
process = Popen(cmd, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
|
||||
out, err = process.communicate()
|
||||
if process.returncode != 0:
|
||||
@@ -164,7 +168,7 @@ def download_wheel(packages, for_py_version, to_folder, app_data):
|
||||
|
||||
|
||||
@contextmanager
|
||||
-def pip_wheel_env_run(version, app_data):
|
||||
+def pip_wheel_env_run(version, executable, app_data):
|
||||
env = os.environ.copy()
|
||||
env.update(
|
||||
{
|
||||
@@ -172,7 +176,11 @@ def pip_wheel_env_run(version, app_data):
|
||||
for k, v in {"PIP_USE_WHEEL": "1", "PIP_USER": "0", "PIP_NO_INPUT": "1"}.items()
|
||||
},
|
||||
)
|
||||
- with ensure_file_on_disk(get_bundled_wheel("pip", version), app_data) as pip_wheel_path:
|
||||
- # put the bundled wheel onto the path, and use it to do the bootstrap operation
|
||||
- env[str("PYTHONPATH")] = str(pip_wheel_path)
|
||||
- yield env
|
||||
+
|
||||
+ paths = list(get_system_wheels_paths(executable))
|
||||
+ pip_wheels = []
|
||||
+ for path in paths:
|
||||
+ pip_wheels.extend([str(wheel) for wheel in path.glob("pip-*")])
|
||||
+ env[str("PYTHONPATH")] = pip_wheels[0] # Use first pip in the list (ensurepip, if exists)
|
||||
+
|
||||
+ yield env
|
||||
diff --git a/src/virtualenv/seed/via_app_data/via_app_data.py b/src/virtualenv/seed/via_app_data/via_app_data.py
|
||||
index de3757d..db7c6d9 100644
|
||||
--- a/src/virtualenv/seed/via_app_data/via_app_data.py
|
||||
+++ b/src/virtualenv/seed/via_app_data/via_app_data.py
|
||||
@@ -38,6 +38,7 @@ class FromAppData(BaseEmbed):
|
||||
def run(self, creator):
|
||||
if not self.enabled:
|
||||
return
|
||||
+ self.insert_system_wheels_paths(creator)
|
||||
base_cache = self.base_cache / creator.interpreter.version_release_str
|
||||
with self._get_seed_wheels(creator, base_cache) as name_to_whl:
|
||||
pip_version = name_to_whl["pip"].stem.split("-")[1] if "pip" in name_to_whl else None
|
||||
diff --git a/src/virtualenv/util/path/_system_wheels.py b/src/virtualenv/util/path/_system_wheels.py
|
||||
new file mode 100644
|
||||
index 0000000..a968dee
|
||||
--- /dev/null
|
||||
+++ b/src/virtualenv/util/path/_system_wheels.py
|
||||
@@ -0,0 +1,22 @@
|
||||
+from subprocess import check_output, CalledProcessError
|
||||
+
|
||||
+from virtualenv.util.path import Path
|
||||
+
|
||||
+
|
||||
+def get_system_wheels_paths(executable):
|
||||
+ # ensurepip wheels
|
||||
+ # We need subprocess here to check ensurepip with the Python we are creating
|
||||
+ # a new virtual environment for
|
||||
+ try:
|
||||
+ import ensurepip
|
||||
+ ensurepip_path = os.path.join(ensurepip.__path__[0], "_bundled")
|
||||
+ except (ImportError, AttributeError, IndexError):
|
||||
+ ensurepip_path = check_output((executable, "-u", "-c", 'import ensurepip; print(ensurepip.__path__[0])'), universal_newlines=True)
|
||||
+ ensurepip_path = Path(ensurepip_path.strip()) / "_bundled"
|
||||
+ except CalledProcessError:
|
||||
+ pass
|
||||
+ else:
|
||||
+ if os.path.isdir(ensurepip_path):
|
||||
+ dirs.insert(0, ensurepip_path)
|
||||
+ yield dirs
|
||||
elif IS_ZIPAPP:
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
try:
|
||||
@@ -998,6 +998,8 @@ def find_wheels(projects, search_dirs):
|
||||
)
|
||||
if project == "pip" and sys.version_info[0:2] == (3, 4):
|
||||
wheel = next(p for v, p in versions if v <= (19, 1, 1))
|
||||
+ elif project == "setuptools" and sys.version_info[0:2] == (3, 4):
|
||||
+ wheel = next(p for v, p in versions if v < (44,))
|
||||
else:
|
||||
wheel = versions[0][1]
|
||||
wheels.append(wheel)
|
||||
@@ -1091,9 +1093,13 @@ def _install_wheel_with_search_dir(download, project_names, py_executable, searc
|
||||
)
|
||||
).encode("utf8")
|
||||
|
||||
- if sys.version_info[0:2] == (3, 4) and "pip" in project_names:
|
||||
- at = project_names.index("pip")
|
||||
- project_names[at] = "pip<19.2"
|
||||
+ if sys.version_info[0:2] == (3, 4):
|
||||
+ if "pip" in project_names:
|
||||
+ at = project_names.index("pip")
|
||||
+ project_names[at] = "pip<19.2"
|
||||
+ if "setuptools" in project_names:
|
||||
+ at = project_names.index("setuptools")
|
||||
+ project_names[at] = "setuptools<44"
|
||||
|
||||
cmd = [py_executable, "-"] + project_names
|
||||
logger.start_progress("Installing {}...".format(", ".join(project_names)))
|
||||
+ if ensurepip_path.is_dir():
|
||||
+ yield ensurepip_path
|
||||
+
|
||||
+ # Standard wheels path
|
||||
+ wheels_dir = Path("/usr/share/python-wheels")
|
||||
+ if wheels_dir.exists():
|
||||
+ yield wheels_dir
|
||||
--
|
||||
2.26.2
|
||||
|
||||
|
@ -1 +1 @@
|
||||
SHA512 (virtualenv-16.7.10.tar.gz) = 28bd2f81d0df629cc69ad06401ba25f2fa5c3e9678255ae151e6f2ef7c7a2b0dc89671355dbb6fb1da3a562180ae3769abca160d9933f3aafba43a6fba08793c
|
||||
SHA512 (virtualenv-20.0.23.tar.gz) = 747ae0031ae587dc2bdc0743dcab7b1673273a5c79fc4bcb539eacd899ddc064b622e567b654fc40bdfdaa90e311d2621856085417b8fd344878546b19cdce84
|
||||
|
Loading…
Reference in new issue