summaryrefslogtreecommitdiffstats
path: root/runtest.py
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 /runtest.py
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 'runtest.py')
-rw-r--r--runtest.py45
1 files changed, 28 insertions, 17 deletions
diff --git a/runtest.py b/runtest.py
index 3ff68f6..96e6dc3 100644
--- a/runtest.py
+++ b/runtest.py
@@ -89,7 +89,6 @@ import getopt
import glob
import os
import os.path
-import popen2
import re
import stat
import string
@@ -345,25 +344,37 @@ class SystemExecutor(Base):
sys.stdout.write("Unexpected exit status %d\n" % s)
try:
- popen2.Popen3
-except AttributeError:
- class PopenExecutor(Base):
- def execute(self):
- (tochild, fromchild, childerr) = os.popen3(self.command_str)
- tochild.close()
- self.stderr = childerr.read()
- self.stdout = fromchild.read()
- fromchild.close()
- self.status = childerr.close()
- if not self.status:
- self.status = 0
+ import subprocess
+except ImportError:
+ import popen2
+ try:
+ popen2.Popen3
+ except AttributeError:
+ class PopenExecutor(Base):
+ def execute(self):
+ (tochild, fromchild, childerr) = os.popen3(self.command_str)
+ tochild.close()
+ self.stderr = childerr.read()
+ self.stdout = fromchild.read()
+ fromchild.close()
+ self.status = childerr.close()
+ if not self.status:
+ self.status = 0
+ else:
+ class PopenExecutor(Base):
+ def execute(self):
+ p = popen2.Popen3(self.command_str, 1)
+ p.tochild.close()
+ self.stdout = p.fromchild.read()
+ self.stderr = p.childerr.read()
+ self.status = p.wait()
else:
class PopenExecutor(Base):
def execute(self):
- p = popen2.Popen3(self.command_str, 1)
- p.tochild.close()
- self.stdout = p.fromchild.read()
- self.stderr = p.childerr.read()
+ p = subprocess.Popen(self.command_str, shell=True)
+ p.stdin.close()
+ self.stdout = p.stdout.read()
+ self.stdout = p.stderr.read()
self.status = p.wait()
class Aegis(SystemExecutor):