From a510bfe657067999904a7ff8d2cabab7b8b508d2 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Mon, 8 Jun 2015 21:10:52 +0200 Subject: Fix SCons qt4 tool pkg-config detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Correctly use pkg-config to test for Qt, if no qt path is specified in config.py. 'Import(…)' at the top caused an error which was hidden by try/catch at upper layer. Test-Information: Tested on Kubuntu 14.04, with and w/o qt path set and verified that no exception is thrown if Qt is registered at pkg-config. Change-Id: I82800c23e9f75bd5f6b136fe384a70165a92bb45 diff --git a/BuildTools/SCons/Tools/qt4.py b/BuildTools/SCons/Tools/qt4.py index 1c82324..afa61de 100644 --- a/BuildTools/SCons/Tools/qt4.py +++ b/BuildTools/SCons/Tools/qt4.py @@ -43,8 +43,7 @@ import SCons.Defaults import SCons.Scanner import SCons.Tool import SCons.Util - -Import("conf_env") +import SCons.SConf class ToolQtWarning(SCons.Warnings.Warning): pass @@ -504,20 +503,18 @@ def enable_modules(self, modules, debug=False, crosscompiling=False, version='4' self["QT4_MOCCPPPATH"] = self["CPPPATH"] return else: - test_env = self.Clone() - test_conf = Configure(test_env) + test_conf = self.Configure() modules_str = " ".join(modules) if not version == '4' : modules_str = modules_str.replace('Qt', 'Qt5') - # Check if Qt is registed at pkg-config + # Check if Qt is registered at pkg-config ret = test_conf.TryAction('pkg-config --exists \'%s\'' % modules_str)[0] - test_conf.Result( ret ) - if not ret: - print("Qt not found.") + if ret != 1: + raise Exception("Qt has not been found using pkg-config.") return - test_env.ParseConfig("pkg-config --cflags --libs " + modules_str) - self.AppendUnique(LIBS=test_env["LIBS"], LIBPATH=test_env["LIBPATH"], CPPPATH=test_env["CPPPATH"]) + test_conf.env.ParseConfig("pkg-config --cflags --libs " + modules_str) + self.AppendUnique(LIBS=test_conf.env["LIBS"], LIBPATH=test_conf.env["LIBPATH"], CPPPATH=test_conf.env["CPPPATH"]) self["QT4_MOCCPPPATH"] = self["CPPPATH"] return -- cgit v0.10.2-6-g49f6