@@ -214,16 +214,25 @@ def lang_files(exts):
214
214
if os .path .splitext (file )[1 ].lower () in exts :
215
215
yield file
216
216
217
+ def bindings_files ():
218
+ for file in lang_files (C_EXTS ):
219
+ print ("check" , file , file .startswith ("shared-bindings/" ), "/bindings/" in file )
220
+ if file .startswith ("shared-bindings/" ) or "/bindings/" in file :
221
+ yield file
222
+
217
223
# Run tool on N files at a time (to avoid making the command line too long).
218
- def batch (cmd , files , N = 200 ):
224
+ def batch (cmd , files , N = 200 , check = False ):
219
225
while True :
220
226
file_args = list (itertools .islice (files , N ))
221
227
if not file_args :
222
228
break
223
229
if args .dry_run :
224
230
print (" " .join (cmd + file_args ))
225
231
else :
226
- subprocess .call (cmd + file_args )
232
+ if check :
233
+ subprocess .check_call (cmd + file_args )
234
+ else :
235
+ subprocess .run (cmd + file_args )
227
236
228
237
# Format C files with uncrustify.
229
238
if format_c :
@@ -234,6 +243,10 @@ def batch(cmd, files, N=200):
234
243
batch (command , lang_files (C_EXTS ))
235
244
for file in lang_files (C_EXTS ):
236
245
fixup_c (file )
246
+ # Format bindings with black_bindings
247
+ if format_py :
248
+ command = ["python3" , "tools/black_bindings.py" ]
249
+ batch (command , bindings_files (), check = True )
237
250
238
251
# Format Python files with black.
239
252
if format_py :
0 commit comments