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