summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDaniel Schürmann <daschuer@mixxx.org>2021-05-31 14:38:38 +0200
committerDaniel Schürmann <daschuer@mixxx.org>2021-05-31 14:38:38 +0200
commit0b2b294b907fdac395c61142cfdd099ef7733af4 (patch)
tree0108c31b68a4b7c35835aef72105e0b12526e1e8 /tools
parentcd91b14230984b8be32f64880355d4c7383fab22 (diff)
only fail qmlformat stage if Qt >= 5.15 is used
Diffstat (limited to 'tools')
-rwxr-xr-xtools/qmlformat.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/tools/qmlformat.py b/tools/qmlformat.py
index 2c18fd9fa2..d0d2920bee 100755
--- a/tools/qmlformat.py
+++ b/tools/qmlformat.py
@@ -7,19 +7,28 @@ import shutil
import subprocess
import pathlib
import sys
+import re
QMLFORMAT_MISSING_MESSAGE = """
-qmlformat is not installed. It is included in Qt 5.15 and later. If that Qt
-version is not available on your system, please use the SKIP environment
-variable when committing:
-
- $ SKIP=qmlformat git commit
+qmlformat not found, please install
"""
def main(argv=None):
qmlformat_executable = shutil.which("qmlformat")
if not qmlformat_executable:
+ # verify if qmlformat is available on this machine
+ moc_executable = shutil.which("moc")
+ if moc_executable:
+ moc_version = subprocess.check_output(
+ (moc_executable, "-v")
+ ).strip()
+ v = re.search("moc ([0-9]*)\\.([0-9]*)\\.[0-9]*", str(moc_version))
+ if v:
+ if int(v.group(1)) < 5:
+ return 0
+ if int(v.group(1)) == 5 and int(v.group(2)) < 15:
+ return 0
print(QMLFORMAT_MISSING_MESSAGE.strip(), file=sys.stderr)
return 1