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