Fix a bug in Qt detection. (Christoph Wiedemann)
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 21 Oct 2003 04:24:52 +0000 (04:24 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 21 Oct 2003 04:24:52 +0000 (04:24 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@824 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/Tool/qt.py
test/QT.py

index f83f35418a8a88094cd93f4f91b281020813d2a8..22edc262ff46a1f99996d11a56e8e8a8af9cf011 100644 (file)
@@ -166,6 +166,8 @@ RELEASE X.XX - XXX
 
   - Fix test/SWIG.py to find the Python include directory in all cases.
 
+  - Fix a bug in detection of Qt installed on the local system.
+
 
 
 RELEASE 0.92 - Wed, 20 Aug 2003 03:45:28 -0500
index d9f690a08af959e517efe7cc7d3c46511efeaa1e..12bf1615493bc71f0a0a35e9d2ffb4832a4ab0b3 100644 (file)
@@ -133,7 +133,7 @@ def _detect(env):
     if not QTDIR:
         moc = env.Detect('moc')
         if moc:
-            QTDIR = dirname(dirname(moc))
+            QTDIR = os.path.dirname(os.path.dirname(moc))
         else:
             QTDIR = None
     env['QTDIR'] = QTDIR
index 0ee8a30fbe324fd72c33828a482f25911a24d98c..ce6bff0c24c2eeb12fc67a16e6a4ce05f9551b36 100644 (file)
@@ -291,9 +291,39 @@ test.fail_test(not os.path.exists(test.workpath('work3', 'build', moc)))
 
 if os.environ.get('QTDIR', None):
 
+    QTDIR=os.environ['QTDIR']
+    
+
     test.write( ['work4', 'SConstruct'],"""
 import os
-env = Environment(tools=['default','qt'], CXXFILESUFFIX=".cpp")
+dummy_env = Environment()
+ENV = dummy_env['ENV']
+try:
+    PATH=ARGUMENTS['PATH']
+    if ENV.has_key('PATH'):
+        ENV_PATH = PATH + ':' + ENV['PATH']
+    else:
+        Exit(0) # this is certainly a weird system :-)
+except KeyError:
+    if ENV.has_key('PATH'):
+        ENV_PATH=dummy_env['ENV']['PATH']
+    else:
+        ENV_PATH=''
+    pass
+
+env = Environment(tools=['default','qt'],
+                  ENV={'PATH':ENV_PATH,
+                       'HOME':os.getcwd()},
+                       # moc / uic want to write stuff in ~/.qt
+                  CXXFILESUFFIX=".cpp")
+
+conf = env.Configure()
+if not conf.CheckLib(env.subst("$QT_LIB")):
+    conf.env['QT_LIB'] = 'qt-mt'
+    if not conf.CheckLib(env.subst("$QT_LIB")):
+         Exit(0)
+env = conf.Finish()
+
 env.Program('test_realqt', ['mocFromCpp.cpp',
                             'mocFromH.cpp',
                             'anUiFile.ui',
@@ -370,6 +400,13 @@ int main() {
 """)
 
     test.run(chdir='work4', arguments="test_realqt" + _exe)
+
+    QTDIR=os.environ['QTDIR']
+    del os.environ['QTDIR']
+
+    test.run(chdir='work4', arguments="-c test_realqt" + _exe)
+    test.run(chdir='work4', arguments="PATH=%s/bin test_realqt%s"%(QTDIR,_exe))
+    
 else:
     print "Could not find QT, skipping test(s)."