3
3
import shutil
4
4
import sys
5
5
import tomllib
6
- from collections .abc import Sequence , Set
6
+ from collections .abc import Set
7
7
from dataclasses import dataclass
8
8
from pathlib import Path
9
9
from tempfile import TemporaryDirectory
18
18
from ..logger import log
19
19
from ..options import Options
20
20
from ..selector import BuildSelector
21
- from ..typing import PathOrStr
22
21
from ..util import resources
23
22
from ..util .cmd import call , shell
24
23
from ..util .file import (
31
30
)
32
31
from ..util .helpers import prepare_command
33
32
from ..util .packaging import combine_constraints , find_compatible_wheel , get_pip_version
34
- from ..venv import virtualenv
33
+ from ..venv import constraint_flags , virtualenv
35
34
36
35
IS_WIN : Final [bool ] = sys .platform .startswith ("win" )
37
36
@@ -145,7 +144,7 @@ def get_base_python(identifier: str) -> Path:
145
144
def setup_python (
146
145
tmp : Path ,
147
146
python_configuration : PythonConfiguration ,
148
- dependency_constraint_flags : Sequence [ PathOrStr ] ,
147
+ constraints_path : Path | None ,
149
148
environment : ParsedEnvironment ,
150
149
) -> dict [str , str ]:
151
150
base_python = get_base_python (python_configuration .identifier )
@@ -166,7 +165,7 @@ def setup_python(
166
165
"install" ,
167
166
"--upgrade" ,
168
167
"pip" ,
169
- * dependency_constraint_flags ,
168
+ * constraint_flags ( constraints_path ) ,
170
169
env = env ,
171
170
cwd = venv_path ,
172
171
)
@@ -198,7 +197,7 @@ def setup_python(
198
197
"auditwheel-emscripten" ,
199
198
"build[virtualenv]" ,
200
199
"pyodide-build" ,
201
- * dependency_constraint_flags ,
200
+ * constraint_flags ( constraints_path ) ,
202
201
env = env ,
203
202
)
204
203
@@ -269,14 +268,11 @@ def build(options: Options, tmp_path: Path) -> None:
269
268
constraints_path = build_options .dependency_constraints .get_for_python_version (
270
269
version = config .version , variant = "pyodide" , tmp_dir = identifier_tmp_dir
271
270
)
272
- dependency_constraint_flags = (
273
- ["-c" , constraints_path .as_uri ()] if constraints_path else []
274
- )
275
271
276
272
env = setup_python (
277
273
identifier_tmp_dir / "build" ,
278
274
config ,
279
- dependency_constraint_flags ,
275
+ constraints_path ,
280
276
build_options .environment ,
281
277
)
282
278
pip_version = get_pip_version (env )
0 commit comments