24
24
)
25
25
26
26
from pip ._internal .cache import WheelCache
27
+ from pip ._internal .locations import GetSchemePredicate , Scheme
27
28
from pip ._internal .req .req_install import InstallRequirement
28
29
29
30
BinaryAllowedPredicate = Callable [[InstallRequirement ], bool ]
@@ -172,6 +173,7 @@ def _build_one(
172
173
build_options , # type: List[str]
173
174
global_options , # type: List[str]
174
175
editable , # type: bool
176
+ scheme , # type: Scheme
175
177
):
176
178
# type: (...) -> Optional[str]
177
179
"""Build one wheel.
@@ -190,7 +192,7 @@ def _build_one(
190
192
# Install build deps into temporary directory (PEP 518)
191
193
with req .build_env :
192
194
return _build_one_inside_env (
193
- req , output_dir , build_options , global_options , editable
195
+ req , output_dir , build_options , global_options , editable , scheme
194
196
)
195
197
196
198
@@ -200,6 +202,7 @@ def _build_one_inside_env(
200
202
build_options , # type: List[str]
201
203
global_options , # type: List[str]
202
204
editable , # type: bool
205
+ scheme , # type: Scheme
203
206
):
204
207
# type: (...) -> Optional[str]
205
208
with TempDirectory (kind = "wheel" ) as temp_dir :
@@ -213,6 +216,7 @@ def _build_one_inside_env(
213
216
build_options = build_options ,
214
217
tempd = temp_dir .path ,
215
218
editable = editable ,
219
+ scheme = scheme ,
216
220
)
217
221
else :
218
222
wheel_path = build_wheel_legacy (
@@ -269,13 +273,16 @@ def build(
269
273
build_options , # type: List[str]
270
274
global_options , # type: List[str]
271
275
allow_editable , # type: bool
276
+ get_scheme_for_editable_req , # type: Optional[GetSchemePredicate]
272
277
):
273
278
# type: (...) -> BuildResult
274
279
"""Build wheels.
275
280
276
281
:return: The list of InstallRequirement that succeeded to build and
277
282
the list of InstallRequirement that failed to build.
278
283
"""
284
+ assert allow_editable == bool (get_scheme_for_editable_req )
285
+
279
286
if not requirements :
280
287
return [], []
281
288
@@ -289,11 +296,15 @@ def build(
289
296
build_successes , build_failures = [], []
290
297
for req in requirements :
291
298
cache_dir = _get_cache_dir (req , wheel_cache )
299
+ scheme = None
300
+ if get_scheme_for_editable_req :
301
+ scheme = get_scheme_for_editable_req (req .name )
292
302
wheel_file = _build_one (
293
303
req , cache_dir ,
294
304
build_options ,
295
305
global_options ,
296
306
allow_editable and req .editable ,
307
+ scheme = scheme ,
297
308
)
298
309
if wheel_file :
299
310
# Update the link for this.
0 commit comments