Skip to content

Commit 53ae7ed

Browse files
committed
fix: use uri's to make uv happy
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 775c2b3 commit 53ae7ed

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

cibuildwheel/platforms/macos.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,8 @@ def build(options: Options, tmp_path: Path) -> None:
438438
constraints_path = build_options.dependency_constraints.get_for_python_version(
439439
version=config.version, tmp_dir=identifier_tmp_dir
440440
)
441-
dependency_constraint_flags: Sequence[PathOrStr] = (
442-
["-c", constraints_path] if constraints_path else []
441+
dependency_constraint_flags = (
442+
["-c", constraints_path.as_uri()] if constraints_path else []
443443
)
444444

445445
base_python, env = setup_python(

cibuildwheel/platforms/pyodide.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@ def build(options: Options, tmp_path: Path) -> None:
269269
constraints_path = build_options.dependency_constraints.get_for_python_version(
270270
version=config.version, variant="pyodide", tmp_dir=identifier_tmp_dir
271271
)
272-
dependency_constraint_flags: Sequence[PathOrStr] = (
273-
["-c", constraints_path] if constraints_path else []
272+
dependency_constraint_flags = (
273+
["-c", constraints_path.as_uri()] if constraints_path else []
274274
)
275275

276276
env = setup_python(

cibuildwheel/platforms/windows.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,8 @@ def build(options: Options, tmp_path: Path) -> None:
370370
version=config.version,
371371
tmp_dir=identifier_tmp_dir,
372372
)
373-
dependency_constraint_flags: Sequence[PathOrStr] = (
374-
["-c", constraints_path] if constraints_path else []
373+
dependency_constraint_flags = (
374+
["-c", constraints_path.as_uri()] if constraints_path else []
375375
)
376376

377377
# install Python

cibuildwheel/venv.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import shutil
55
import sys
66
import tomllib
7+
import urllib.parse
78
from collections.abc import Sequence
89
from pathlib import Path
910
from typing import Final
@@ -51,7 +52,13 @@ def _parse_pip_constraint_for_virtualenv(
5152
assert len(dependency_constraint_flags) in {0, 2}
5253
if len(dependency_constraint_flags) == 2:
5354
assert dependency_constraint_flags[0] == "-c"
54-
constraint_path = Path(dependency_constraint_flags[1])
55+
dep_c = dependency_constraint_flags[1]
56+
# Path.from_uri added in 3.13
57+
constraint_path = (
58+
Path(urllib.parse.unquote(urllib.parse.urlparse(dep_c).path))
59+
if isinstance(dep_c, str) and dep_c.startswith("file:")
60+
else Path(dep_c)
61+
)
5562
assert constraint_path.exists()
5663
with constraint_path.open(encoding="utf-8") as constraint_file:
5764
for line_ in constraint_file:

0 commit comments

Comments
 (0)