From 4cb7fa8e28cbe7fd23c000e4657300f1db0726ae Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Wed, 13 Oct 2021 10:51:04 +0800 Subject: [PATCH] ci(check): force check clang-format version GitOrigin-RevId: 5080264f5fca298f9c33f3a6f95670c8ddecb6c8 --- tools/format.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/format.py b/tools/format.py index ed1f222f..af0c0afd 100755 --- a/tools/format.py +++ b/tools/format.py @@ -104,6 +104,21 @@ def main(): else: raise ValueError("Invalid path {}".format(path)) + # check version, we only support 12.0.1 now + version = subprocess.check_output( + [ + args.clang_format, + "--version", + ], + ) + version = version.decode("utf-8") + + need_version = '12.0.1' + if version.find(need_version) < 0: + print('We only support {} now, please install {} version, find version: {}' + .format(need_version, need_version, version)) + raise RuntimeError('clang-format version not equal {}'.format(need_version)) + process_map( partial(process_file, clang_format=args.clang_format, write=args.write,), files,