Skip to content

Commit

Permalink
Merge pull request #3929 from daschuer/qmlformat
Browse files Browse the repository at this point in the history
only fail qmlformat stage if Qt >= 5.15 is used
  • Loading branch information
uklotzde authored Jun 12, 2021
2 parents 8f1356a + cb8e82c commit 9fa60a7
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions tools/qmlformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,25 @@
import re

QMLFORMAT_MISSING_MESSAGE = """
qmlformat is not installed or not in your $PATH. 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 is not installed or not in your $PATH, 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:
version = (int(v.group(1)), int(v.group(2)))
if version < (5, 15):
# Succeed if a Qt Version < 5.15 is used without qmlformat
return 0
print(QMLFORMAT_MISSING_MESSAGE.strip(), file=sys.stderr)
return 1

Expand Down

0 comments on commit 9fa60a7

Please sign in to comment.