33import shutil
44import sys
55import tomllib
6- from collections .abc import Sequence , Set
6+ from collections .abc import Set
77from dataclasses import dataclass
88from pathlib import Path
99from tempfile import TemporaryDirectory
1818from ..logger import log
1919from ..options import Options
2020from ..selector import BuildSelector
21- from ..typing import PathOrStr
2221from ..util import resources
2322from ..util .cmd import call , shell
2423from ..util .file import (
3130)
3231from ..util .helpers import prepare_command
3332from ..util .packaging import combine_constraints , find_compatible_wheel , get_pip_version
34- from ..venv import virtualenv
33+ from ..venv import constraint_flags , virtualenv
3534
3635IS_WIN : Final [bool ] = sys .platform .startswith ("win" )
3736
@@ -145,7 +144,7 @@ def get_base_python(identifier: str) -> Path:
145144def setup_python (
146145 tmp : Path ,
147146 python_configuration : PythonConfiguration ,
148- dependency_constraint_flags : Sequence [ PathOrStr ] ,
147+ constraints_path : Path | None ,
149148 environment : ParsedEnvironment ,
150149) -> dict [str , str ]:
151150 base_python = get_base_python (python_configuration .identifier )
@@ -166,7 +165,7 @@ def setup_python(
166165 "install" ,
167166 "--upgrade" ,
168167 "pip" ,
169- * dependency_constraint_flags ,
168+ * constraint_flags ( constraints_path ) ,
170169 env = env ,
171170 cwd = venv_path ,
172171 )
@@ -198,7 +197,7 @@ def setup_python(
198197 "auditwheel-emscripten" ,
199198 "build[virtualenv]" ,
200199 "pyodide-build" ,
201- * dependency_constraint_flags ,
200+ * constraint_flags ( constraints_path ) ,
202201 env = env ,
203202 )
204203
@@ -269,14 +268,11 @@ def build(options: Options, tmp_path: Path) -> None:
269268 constraints_path = build_options .dependency_constraints .get_for_python_version (
270269 version = config .version , variant = "pyodide" , tmp_dir = identifier_tmp_dir
271270 )
272- dependency_constraint_flags = (
273- ["-c" , constraints_path .as_uri ()] if constraints_path else []
274- )
275271
276272 env = setup_python (
277273 identifier_tmp_dir / "build" ,
278274 config ,
279- dependency_constraint_flags ,
275+ constraints_path ,
280276 build_options .environment ,
281277 )
282278 pip_version = get_pip_version (env )
0 commit comments