@@ -115,7 +115,7 @@ def setup_python(
115
115
python_configuration : PythonConfiguration ,
116
116
dependency_constraint_flags : Sequence [PathOrStr ],
117
117
environment : ParsedEnvironment ,
118
- pypa_build : bool ,
118
+ build_frontend : str ,
119
119
) -> Dict [str , str ]:
120
120
121
121
nuget = Path ("C:\\ cibw\\ nuget.exe" )
@@ -218,12 +218,7 @@ def setup_python(
218
218
219
219
call (["pip" , "--version" ], env = env )
220
220
221
- if pypa_build :
222
- call (
223
- ["pip" , "install" , "--upgrade" , "build[virtualenv]" , * dependency_constraint_flags ],
224
- env = env ,
225
- )
226
- else :
221
+ if build_frontend == "pip" :
227
222
call (
228
223
[
229
224
"pip" ,
@@ -235,6 +230,13 @@ def setup_python(
235
230
],
236
231
env = env ,
237
232
)
233
+ elif build_frontend == "build" :
234
+ call (
235
+ ["pip" , "install" , "--upgrade" , "build[virtualenv]" , * dependency_constraint_flags ],
236
+ env = env ,
237
+ )
238
+ else :
239
+ raise RuntimeError (f"build_frontend { build_frontend !r} not understood" )
238
240
239
241
return env
240
242
@@ -272,7 +274,7 @@ def build(options: BuildOptions) -> None:
272
274
config ,
273
275
dependency_constraint_flags ,
274
276
options .environment ,
275
- options .pypa_build ,
277
+ options .build_frontend ,
276
278
)
277
279
278
280
# run the before_build command
@@ -290,7 +292,23 @@ def build(options: BuildOptions) -> None:
290
292
291
293
verbosity_flags = get_build_verbosity_extra_flags (options .build_verbosity )
292
294
293
- if options .pypa_build :
295
+ if options .build_frontend == "pip" :
296
+ # Path.resolve() is needed. Without it pip wheel may try to fetch package from pypi.org
297
+ # see https://github.com/pypa/cibuildwheel/pull/369
298
+ call (
299
+ [
300
+ "python" ,
301
+ "-m" ,
302
+ "pip" ,
303
+ "wheel" ,
304
+ options .package_dir .resolve (),
305
+ f"--wheel-dir={ built_wheel_dir } " ,
306
+ "--no-deps" ,
307
+ * get_build_verbosity_extra_flags (options .build_verbosity ),
308
+ ],
309
+ env = env ,
310
+ )
311
+ elif options .build_frontend == "build" :
294
312
config_setting = " " .join (verbosity_flags )
295
313
build_env = dict (env )
296
314
if options .dependency_constraints :
@@ -311,21 +329,7 @@ def build(options: BuildOptions) -> None:
311
329
env = build_env ,
312
330
)
313
331
else :
314
- # Path.resolve() is needed. Without it pip wheel may try to fetch package from pypi.org
315
- # see https://github.com/pypa/cibuildwheel/pull/369
316
- call (
317
- [
318
- "python" ,
319
- "-m" ,
320
- "pip" ,
321
- "wheel" ,
322
- options .package_dir .resolve (),
323
- f"--wheel-dir={ built_wheel_dir } " ,
324
- "--no-deps" ,
325
- * get_build_verbosity_extra_flags (options .build_verbosity ),
326
- ],
327
- env = env ,
328
- )
332
+ raise RuntimeError (f"build_frontend { options .build_frontend !r} not understood" )
329
333
330
334
built_wheel = next (built_wheel_dir .glob ("*.whl" ))
331
335
0 commit comments