diff options
author | Tobias Markmann <tm@ayena.de> | 2015-06-15 22:06:31 (GMT) |
---|---|---|
committer | Kevin Smith <kevin.smith@isode.com> | 2015-06-18 09:48:39 (GMT) |
commit | c565fb97c2925b66f81e05ffb6a394d3d53173a0 (patch) | |
tree | 87348cf4e53360465920bc0d07419e3a46bb5c63 /BuildTools/SCons/Tools | |
parent | 823d751ca2ca5c7b36ce674f20c57f7a5196d992 (diff) | |
download | swift-c565fb97c2925b66f81e05ffb6a394d3d53173a0.zip swift-c565fb97c2925b66f81e05ffb6a394d3d53173a0.tar.bz2 |
Have SCons qt4 tool check for real moc or qtchooser
Some platforms, e.g. KUbuntu, provide a wrapper around Qt's commands
that allow easy switching between different Qt versions. With this
change SCons will execute the found moc tool and check whether it works
or not.
Test-Information:
Tested with correctly installed Qt and uninstalled Qt on KUbuntu 14.04.
Change-Id: I88f0a36af462e909829c30115aa5481abdcd3ac6
Diffstat (limited to 'BuildTools/SCons/Tools')
-rw-r--r-- | BuildTools/SCons/Tools/qt4.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/BuildTools/SCons/Tools/qt4.py b/BuildTools/SCons/Tools/qt4.py index afa61de..625f807 100644 --- a/BuildTools/SCons/Tools/qt4.py +++ b/BuildTools/SCons/Tools/qt4.py @@ -36,6 +36,7 @@ __revision__ = "/home/scons/scons/branch.0/branch.96/baseline/src/engine/SCons/T import os.path import re +import subprocess import SCons.Action import SCons.Builder @@ -207,14 +208,18 @@ def _detect(env): else : moc = env.WhereIs('moc-qt4') or env.WhereIs('moc4') or env.WhereIs('moc') if moc: - import sys - if sys.platform == "darwin" : - return "" - QTDIR = os.path.dirname(os.path.dirname(moc)) - SCons.Warnings.warn( - QtdirNotFound, - "QTDIR variable is not defined, using moc executable as a hint (QTDIR=%s)" % QTDIR) - return QTDIR + # Test whether the moc command we found is real, or whether it is just the qtchooser dummy. + p = subprocess.Popen([moc, "-v"], shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) + p.communicate() + if p.returncode == 0: + import sys + if sys.platform == "darwin" : + return "" + QTDIR = os.path.dirname(os.path.dirname(moc)) + SCons.Warnings.warn( + QtdirNotFound, + "QTDIR variable is not defined, using moc executable as a hint (QTDIR=%s)" % QTDIR) + return QTDIR raise SCons.Errors.StopError( QtdirNotFound, |