Skip to content

Commit 5b65230

Browse files
fix: virtualenv 20.31 no-wheel (pypa#2382)
* fix: virtualenv 20.31 no-wheel Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * fix: show failed output on failure Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update linux.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update linux.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 04c9427 commit 5b65230

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

cibuildwheel/platforms/linux.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,9 @@ def build_in_container(
353353
container.call(["uv", "venv", venv_dir, "--python", python_bin / "python"], env=env)
354354
else:
355355
# Use embedded dependencies from virtualenv to ensure determinism
356-
venv_args = ["--no-periodic-update", "--pip=embed", "--no-setuptools", "--no-wheel"]
356+
venv_args = ["--no-periodic-update", "--pip=embed", "--no-setuptools"]
357+
if "38" in config.identifier:
358+
venv_args.append("--no-wheel")
357359
container.call(["python", "-m", "virtualenv", *venv_args, venv_dir], env=env)
358360

359361
virtualenv_env = env.copy()

cibuildwheel/venv.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121

2222
@functools.cache
23-
def _ensure_virtualenv(version: str) -> Path:
23+
def _ensure_virtualenv(version: str) -> tuple[Path, Version]:
2424
version_parts = version.split(".")
2525
key = f"py{version_parts[0]}{version_parts[1]}"
2626
with resources.VIRTUALENV.open("rb") as f:
@@ -32,7 +32,7 @@ def _ensure_virtualenv(version: str) -> Path:
3232
with FileLock(str(path) + ".lock"):
3333
if not path.exists():
3434
download(url, path)
35-
return path
35+
return (path, Version(version))
3636

3737

3838
def constraint_flags(
@@ -110,10 +110,12 @@ def virtualenv(
110110
if use_uv:
111111
call("uv", "venv", venv_path, "--python", python)
112112
else:
113-
virtualenv_app = _ensure_virtualenv(version)
113+
virtualenv_app, virtualenv_version = _ensure_virtualenv(version)
114114
if pip_version is None:
115115
pip_version = _parse_pip_constraint_for_virtualenv(dependency_constraint)
116-
additional_flags = [f"--pip={pip_version}", "--no-setuptools", "--no-wheel"]
116+
additional_flags = [f"--pip={pip_version}", "--no-setuptools"]
117+
if virtualenv_version < Version("20.31") or Version(version) < Version("3.9"):
118+
additional_flags.append("--no-wheel")
117119

118120
# Using symlinks to pre-installed seed packages is really the fastest way to get a virtual
119121
# environment. The initial cost is a bit higher but reusing is much faster.

0 commit comments

Comments
 (0)