[Bf-blender-cvs] [26bbe63fb0a] temp-clang-format: Clang-format: make format is now multithreaded.
Brecht Van Lommel
noreply at git.blender.org
Thu Mar 21 18:18:08 CET 2019
Commit: 26bbe63fb0a5c9d16d034db0c592d45cc64c3a9f
Author: Brecht Van Lommel
Date: Thu Jan 10 16:44:50 2019 +0100
Branches: temp-clang-format
https://developer.blender.org/rB26bbe63fb0a5c9d16d034db0c592d45cc64c3a9f
Clang-format: make format is now multithreaded.
===================================================================
M clang-format-paths.py
===================================================================
diff --git a/clang-format-paths.py b/clang-format-paths.py
index 5b83659541d..15e1777bc1e 100755
--- a/clang-format-paths.py
+++ b/clang-format-paths.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
+import multiprocessing
import os
import sys
import subprocess
@@ -95,12 +96,23 @@ def clang_format_version():
return version
+def clang_format_file(f):
+ cmd = (
+ CLANG_FORMAT_CMD, "-i", "-verbose", f.encode("ascii")
+ )
+ return subprocess.check_output(cmd, stderr=subprocess.STDOUT)
+
+
+def clang_print_output(output):
+ print(output.decode('utf8', errors='ignore').strip())
+
+
def clang_format(files):
+ pool = multiprocessing.Pool()
for f in files:
- cmd = (
- CLANG_FORMAT_CMD, "-i", "-verbose", f.encode("ascii")
- )
- subprocess.check_call(cmd)
+ pool.apply_async(clang_format_file, args=[f], callback=clang_print_output)
+ pool.close()
+ pool.join()
def main():
More information about the Bf-blender-cvs
mailing list