aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/scripts
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2019-09-30 00:07:32 +0300
committerGitHub <noreply@github.com>2019-09-30 00:07:32 +0300
commit1473fbc3f6c412ef83a9a96c8b6df5f60571fc3c (patch)
treea183b2c0eb3a2f7ce85e8c9bd8bf6a2d2afd6707 /mesonbuild/scripts
parent0008b326ffc39c86be2ae4352bdddc03f01840cc (diff)
parent24bd0294372d388160d3b093407d6f0db9aa5481 (diff)
downloadmeson-1473fbc3f6c412ef83a9a96c8b6df5f60571fc3c.zip
meson-1473fbc3f6c412ef83a9a96c8b6df5f60571fc3c.tar.gz
meson-1473fbc3f6c412ef83a9a96c8b6df5f60571fc3c.tar.bz2
Merge pull request #5939 from lantw44/move-the-list-of-llvm-versions-to-a-common-place
Move the list of LLVM versions to a common place
Diffstat (limited to 'mesonbuild/scripts')
-rw-r--r--mesonbuild/scripts/clangformat.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/mesonbuild/scripts/clangformat.py b/mesonbuild/scripts/clangformat.py
index 351d06b..4b441de 100644
--- a/mesonbuild/scripts/clangformat.py
+++ b/mesonbuild/scripts/clangformat.py
@@ -16,9 +16,10 @@ import pathlib
import subprocess
from concurrent.futures import ThreadPoolExecutor
+from ..environment import detect_clangformat
from ..compilers import lang_suffixes
-def clangformat(srcdir_name, builddir_name):
+def clangformat(exelist, srcdir_name, builddir_name):
srcdir = pathlib.Path(srcdir_name)
suffixes = set(lang_suffixes['c']).union(set(lang_suffixes['cpp']))
suffixes.add('h')
@@ -28,11 +29,17 @@ def clangformat(srcdir_name, builddir_name):
strf = str(f)
if strf.startswith(builddir_name):
continue
- futures.append(e.submit(subprocess.check_call, ['clang-format', '-style=file', '-i', strf]))
+ futures.append(e.submit(subprocess.check_call, exelist + ['-style=file', '-i', strf]))
[x.result() for x in futures]
return 0
def run(args):
srcdir_name = args[0]
builddir_name = args[1]
- return clangformat(srcdir_name, builddir_name)
+
+ exelist = detect_clangformat()
+ if not exelist:
+ print('Could not execute clang-format "%s"' % ' '.join(exelist))
+ return 1
+
+ return clangformat(exelist, srcdir_name, builddir_name)