check uncrustify version
This commit is contained in:
parent
d294692c4e
commit
a36b930ead
@ -119,6 +119,15 @@ C_EXTS = (
|
|||||||
)
|
)
|
||||||
PY_EXTS = (".py",)
|
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
|
# Transform a filename argument relative to the current directory into one
|
||||||
# relative to the TOP directory, which is what we need when checking against
|
# relative to the TOP directory, which is what we need when checking against
|
||||||
# path_rx.
|
# path_rx.
|
||||||
@ -218,6 +227,7 @@ def main():
|
|||||||
|
|
||||||
# Format C files with uncrustify.
|
# Format C files with uncrustify.
|
||||||
if format_c:
|
if format_c:
|
||||||
|
check_uncrustify_version()
|
||||||
command = ["uncrustify", "-c", UNCRUSTIFY_CFG, "-lC", "--no-backup"]
|
command = ["uncrustify", "-c", UNCRUSTIFY_CFG, "-lC", "--no-backup"]
|
||||||
if not args.v:
|
if not args.v:
|
||||||
command.append("-q")
|
command.append("-q")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user