[Bf-blender-cvs] [2152f5e2a90] temp-clang-format: Clang-format: Make it easier to tweak running command

Sergey Sharybin noreply at git.blender.org
Thu Mar 21 17:11:23 CET 2019


Commit: 2152f5e2a905e4ddea52565f66fb942f0aab939c
Author: Sergey Sharybin
Date:   Thu Mar 21 17:03:11 2019 +0100
Branches: temp-clang-format
https://developer.blender.org/rB2152f5e2a905e4ddea52565f66fb942f0aab939c

Clang-format: Make it easier to tweak running command

Allows to compare behavior of various clang-format versions.

===================================================================

M	clang-format-paths.py

===================================================================

diff --git a/clang-format-paths.py b/clang-format-paths.py
index 4157ac3bffe..5b83659541d 100755
--- a/clang-format-paths.py
+++ b/clang-format-paths.py
@@ -4,6 +4,7 @@ import os
 import sys
 import subprocess
 
+CLANG_FORMAT_CMD = "clang-format"
 VERSION_MIN = (6, 0, 0)
 
 # Optionally pass in files to operate on.
@@ -86,7 +87,7 @@ def convert_tabs_to_spaces(files):
 
 
 def clang_format_version():
-    version_output = subprocess.check_output(("clang-format", "-version")).decode('utf-8')
+    version_output = subprocess.check_output((CLANG_FORMAT_CMD, "-version")).decode('utf-8')
     version = next(iter(v for v in version_output.split() if v[0].isdigit()), None)
     if version is not None:
         version = version.split("-")[0]
@@ -97,7 +98,7 @@ def clang_format_version():
 def clang_format(files):
     for f in files:
         cmd = (
-            "clang-format", "-i", "-verbose", f.encode("ascii")
+            CLANG_FORMAT_CMD, "-i", "-verbose", f.encode("ascii")
         )
         subprocess.check_call(cmd)



More information about the Bf-blender-cvs mailing list