summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-06-15 22:06:31 (GMT)
committerKevin Smith <kevin.smith@isode.com>2015-06-18 09:48:39 (GMT)
commitc565fb97c2925b66f81e05ffb6a394d3d53173a0 (patch)
tree87348cf4e53360465920bc0d07419e3a46bb5c63
parent823d751ca2ca5c7b36ce674f20c57f7a5196d992 (diff)
downloadswift-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
-rw-r--r--BuildTools/SCons/Tools/qt4.py21
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
@@ -33,12 +33,13 @@ selection method.
#
__revision__ = "/home/scons/scons/branch.0/branch.96/baseline/src/engine/SCons/Tool/qt.py 0.96.92.D001 2006/04/10 23:13:27 knight"
import os.path
import re
+import subprocess
import SCons.Action
import SCons.Builder
import SCons.Defaults
import SCons.Scanner
import SCons.Tool
@@ -204,20 +205,24 @@ def _detect(env):
moc = None
if env["qt5"]:
moc = env.WhereIs('moc-qt5') or env.WhereIs('moc5') or env.WhereIs('moc')
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,
"Could not detect Qt 4 installation")
return None