24
24
from ..logger import log
25
25
from ..options import Options
26
26
from ..selector import BuildSelector
27
- from ..typing import PathOrStr
28
27
from ..util import resources
29
28
from ..util .cmd import call , shell
30
29
from ..util .file import (
39
38
find_compatible_wheel ,
40
39
get_pip_version ,
41
40
)
42
- from ..venv import virtualenv
41
+ from ..venv import constraint_flags , virtualenv
43
42
from .macos import install_cpython as install_build_cpython
44
43
45
44
@@ -151,7 +150,7 @@ def cross_virtualenv(
151
150
multiarch : str ,
152
151
build_python : Path ,
153
152
venv_path : Path ,
154
- dependency_constraint_flags : Sequence [ PathOrStr ] ,
153
+ dependency_constraint : Path | None ,
155
154
xbuild_tools : Sequence [str ] | None ,
156
155
) -> dict [str , str ]:
157
156
"""Create a cross-compilation virtual environment.
@@ -178,8 +177,8 @@ def cross_virtualenv(
178
177
:param build_python: The path to the python binary for the build platform
179
178
:param venv_path: The path where the cross virtual environment should be
180
179
created.
181
- :param dependency_constraint_flags: Any flags that should be used when
182
- constraining dependencies in the environment.
180
+ :param dependency_constraint: A path to a constraint file that should be
181
+ used when constraining dependencies in the environment.
183
182
:param xbuild_tools: A list of executable names (without paths) that are
184
183
on the path, but must be preserved in the cross environment.
185
184
"""
@@ -188,7 +187,7 @@ def cross_virtualenv(
188
187
py_version ,
189
188
build_python ,
190
189
venv_path ,
191
- dependency_constraint_flags ,
190
+ dependency_constraint ,
192
191
use_uv = False ,
193
192
)
194
193
@@ -279,7 +278,7 @@ def setup_python(
279
278
tmp : Path ,
280
279
* ,
281
280
python_configuration : PythonConfiguration ,
282
- dependency_constraint_flags : Sequence [ PathOrStr ] ,
281
+ dependency_constraint : Path | None ,
283
282
environment : ParsedEnvironment ,
284
283
build_frontend : BuildFrontendName ,
285
284
xbuild_tools : Sequence [str ] | None ,
@@ -334,7 +333,7 @@ def setup_python(
334
333
multiarch = python_configuration .multiarch ,
335
334
build_python = build_python ,
336
335
venv_path = venv_path ,
337
- dependency_constraint_flags = dependency_constraint_flags ,
336
+ dependency_constraint = dependency_constraint ,
338
337
xbuild_tools = xbuild_tools ,
339
338
)
340
339
venv_bin_path = venv_path / "bin"
@@ -351,7 +350,7 @@ def setup_python(
351
350
"install" ,
352
351
"--upgrade" ,
353
352
"pip" ,
354
- * dependency_constraint_flags ,
353
+ * constraint_flags ( dependency_constraint ) ,
355
354
env = env ,
356
355
cwd = venv_path ,
357
356
)
@@ -397,7 +396,7 @@ def setup_python(
397
396
"install" ,
398
397
"--upgrade" ,
399
398
"build[virtualenv]" ,
400
- * dependency_constraint_flags ,
399
+ * constraint_flags ( dependency_constraint ) ,
401
400
env = env ,
402
401
)
403
402
else :
@@ -453,14 +452,11 @@ def build(options: Options, tmp_path: Path) -> None:
453
452
constraints_path = build_options .dependency_constraints .get_for_python_version (
454
453
version = config .version , tmp_dir = identifier_tmp_dir
455
454
)
456
- dependency_constraint_flags : Sequence [PathOrStr ] = (
457
- ["-c" , constraints_path ] if constraints_path else []
458
- )
459
455
460
456
target_install_path , env = setup_python (
461
457
identifier_tmp_dir / "build" ,
462
458
python_configuration = config ,
463
- dependency_constraint_flags = dependency_constraint_flags ,
459
+ dependency_constraint = constraints_path ,
464
460
environment = build_options .environment ,
465
461
build_frontend = build_frontend .name ,
466
462
xbuild_tools = build_options .xbuild_tools ,
0 commit comments