check uncrustify version

This commit is contained in:
Jeff Epler 2021-08-11 11:48:35 -05:00
parent d294692c4e
commit a36b930ead
1 changed files with 10 additions and 0 deletions

View File

@ -119,6 +119,15 @@ C_EXTS = (
)
PY_EXTS = (".py",)
def check_uncrustify_version():
version = subprocess.check_output(
["uncrustify", "--version"], encoding="utf-8", errors="replace"
)
if version < "Uncrustify-0.71":
raise SystemExit(f"codeformat.py requires Uncrustify 0.71 or newer, got {version}")
# Transform a filename argument relative to the current directory into one
# relative to the TOP directory, which is what we need when checking against
# path_rx.
@ -218,6 +227,7 @@ def main():
# Format C files with uncrustify.
if format_c:
check_uncrustify_version()
command = ["uncrustify", "-c", UNCRUSTIFY_CFG, "-lC", "--no-backup"]
if not args.v:
command.append("-q")