@@ -115,7 +115,9 @@ def setup_python(
115
115
python_configuration : PythonConfiguration ,
116
116
dependency_constraint_flags : Sequence [PathOrStr ],
117
117
environment : ParsedEnvironment ,
118
+ pypa_build : bool ,
118
119
) -> Dict [str , str ]:
120
+
119
121
nuget = Path ("C:\\ cibw\\ nuget.exe" )
120
122
if not nuget .exists ():
121
123
log .step ("Downloading nuget..." )
@@ -199,10 +201,24 @@ def setup_python(
199
201
env = env ,
200
202
)
201
203
call (["pip" , "--version" ], env = env )
202
- call (
203
- ["pip" , "install" , "--upgrade" , "setuptools" , "wheel" , * dependency_constraint_flags ],
204
- env = env ,
205
- )
204
+
205
+ if pypa_build :
206
+ call (
207
+ ["pip" , "install" , "--upgrade" , "build" , * dependency_constraint_flags ],
208
+ env = env ,
209
+ )
210
+ else :
211
+ call (
212
+ [
213
+ "pip" ,
214
+ "install" ,
215
+ "--upgrade" ,
216
+ "setuptools" ,
217
+ "wheel" ,
218
+ * dependency_constraint_flags ,
219
+ ],
220
+ env = env ,
221
+ )
206
222
207
223
return env
208
224
@@ -236,7 +252,12 @@ def build(options: BuildOptions) -> None:
236
252
]
237
253
238
254
# install Python
239
- env = setup_python (config , dependency_constraint_flags , options .environment )
255
+ env = setup_python (
256
+ config ,
257
+ dependency_constraint_flags ,
258
+ options .environment ,
259
+ options .pypa_build ,
260
+ )
240
261
241
262
# run the before_build command
242
263
if options .before_build :
@@ -250,20 +271,39 @@ def build(options: BuildOptions) -> None:
250
271
if built_wheel_dir .exists ():
251
272
shutil .rmtree (built_wheel_dir )
252
273
built_wheel_dir .mkdir (parents = True )
253
- # Path.resolve() is needed. Without it pip wheel may try to fetch package from pypi.org
254
- # see https://github.com/joerick/cibuildwheel/pull/369
255
- call (
256
- [
257
- "pip" ,
258
- "wheel" ,
259
- options .package_dir .resolve (),
260
- "-w" ,
261
- built_wheel_dir ,
262
- "--no-deps" ,
263
- * get_build_verbosity_extra_flags (options .build_verbosity ),
264
- ],
265
- env = env ,
266
- )
274
+
275
+ verbosity_flags = get_build_verbosity_extra_flags (options .build_verbosity )
276
+
277
+ if options .pypa_build :
278
+ config_setting = " " .join (verbosity_flags )
279
+ call (
280
+ [
281
+ "python" ,
282
+ "-m" ,
283
+ "build" ,
284
+ options .package_dir ,
285
+ "--wheel" ,
286
+ f"--outdir={ built_wheel_dir } " ,
287
+ f"--config-setting={ config_setting } " ,
288
+ ],
289
+ env = env ,
290
+ )
291
+ else :
292
+ # Path.resolve() is needed. Without it pip wheel may try to fetch package from pypi.org
293
+ # see https://github.com/joerick/cibuildwheel/pull/369
294
+ call (
295
+ [
296
+ "python" ,
297
+ "-m" ,
298
+ "pip" ,
299
+ "wheel" ,
300
+ options .package_dir .resolve (),
301
+ f"--wheel-dir={ built_wheel_dir } " ,
302
+ "--no-deps" ,
303
+ * get_build_verbosity_extra_flags (options .build_verbosity ),
304
+ ],
305
+ env = env ,
306
+ )
267
307
268
308
built_wheel = next (built_wheel_dir .glob ("*.whl" ))
269
309
0 commit comments