summaryrefslogtreecommitdiffstats
path: root/QMTest
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2008-10-07 00:39:54 (GMT)
committerSteven Knight <knight@baldmt.com>2008-10-07 00:39:54 (GMT)
commita60a83619bc1524c2014fc897fdfd64c1ab3684d (patch)
tree5d960c8a849ff98d77e89404adc20a04c413cdd4 /QMTest
parentc7ea79b8c747c41b2a53bb8cfe82cb8bd1108475 (diff)
downloadSCons-a60a83619bc1524c2014fc897fdfd64c1ab3684d.zip
SCons-a60a83619bc1524c2014fc897fdfd64c1ab3684d.tar.gz
SCons-a60a83619bc1524c2014fc897fdfd64c1ab3684d.tar.bz2
Rudimentary Python 2.6 portability in the test infrastructure, fixing
"import popen2" warnings that interfere with some of the tests executing cleanly. This converts to using subprocess by default, falling back to popen2 if it's not available.
Diffstat (limited to 'QMTest')
-rw-r--r--QMTest/TestSCons.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py
index c5180d8..a35bf8d 100644
--- a/QMTest/TestSCons.py
+++ b/QMTest/TestSCons.py
@@ -100,12 +100,19 @@ def gccFortranLibs():
a more reliable way, but using popen3 is relatively efficient."""
libs = ['g2c']
+ cmd = 'gcc -v'
try:
- import popen2
- stderr = popen2.popen3('gcc -v')[2]
- except OSError:
- return libs
+ import subprocess
+ except ImportError:
+ try:
+ import popen2
+ stderr = popen2.popen3(cmd)[2]
+ except OSError:
+ return libs
+ else:
+ p = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE)
+ stderr = p.stderr
for l in stderr.readlines():
list = string.split(l)