From aa81f89d86449e889bbcb2d14fd2b99ce8b800b5 Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Fri, 29 Jan 2021 00:55:48 +0100 Subject: [PATCH] added --docker option to run the same clang-format than container on CI --- do-clang-format.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/do-clang-format.py b/do-clang-format.py index 11409fe1f..24973f669 100755 --- a/do-clang-format.py +++ b/do-clang-format.py @@ -69,9 +69,9 @@ else: filelist_clean.append(f) filelist = filelist_clean -cmd = ["clang-format"] +cmd = "clang-format" if "CLANG_FORMAT" in os.environ: - cmd = [os.environ["CLANG_FORMAT"]] + cmd = os.environ["CLANG_FORMAT"] if args.docker: USER=os.environ["USER"] UID=os.getuid() @@ -80,10 +80,14 @@ if args.docker: # note, currently in container it is clang-8 cmd = "docker container run --rm -v {}:/corsika -w /corsika -u {}:{} corsika/devel:clang-8 clang-format-8".format(PWD,UID,GID) cmd += " -style=file" + +version = subp.check_output(cmd.split() + ["--version"]).decode("utf-8") +print (version) + if args.apply: for filename in filelist: subp.check_call(cmd.split() + ["-i", filename]) - + else: # only print files which need formatting files_need_formatting = 0 -- GitLab