WIN32 portability in tests.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 10 Feb 2002 12:13:14 +0000 (12:13 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 10 Feb 2002 12:13:14 +0000 (12:13 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@252 fdb21ef1-2011-0410-befe-b5e4ea1792b1

etc/TestSCons.py
src/CHANGES.txt
test/Scanner.py

index 14c2e0b6b28038b481e2780be5ca56b32b3c7df0..64f92791dda42f3da4f71c3958021c0546457481 100644 (file)
@@ -97,7 +97,7 @@ class TestSCons(TestCmd.TestCmd):
            print "STDERR ============"
            print self.stderr()
            raise
-       if self.status>>8 != status:
+       if not self.status is None and self.status>>8 != status:
            print "%s returned %d" % (self.program, self.status >> 8)
            print "STDERR ============"
            print self.stderr()
index 4b4256f84f89ff37fed7e89a523029f5ad9c6f9d..bb2c7adfbceaafcad8727a89e37ba9f331a29ee2 100644 (file)
@@ -48,6 +48,8 @@ RELEASE 0.05 -
   - Create all of the directories for a list of targets before trying
     to build any of the targets.
 
+  - WIN32 portability fixes in tests.
+
   From Anthony Roach:
 
   - Make the scons script return an error code on failures.
index b44e96a75f82bbe96e46fe7c0cb83c4f0a0f02e8..1a02447a95cf79f991870b6a771d083121ea033a 100644 (file)
@@ -33,20 +33,18 @@ test = TestSCons.TestSCons()
 
 test.write('build.py', r"""
 import sys
-try:
-    input = open(sys.argv[1], 'r')
-except IndexError:
-    input = sys.stdin
+input = open(sys.argv[1], 'rb')
+output = open(sys.argv[2], 'wb')
 
-def process(fp):
-    for line in fp.readlines():
+def process(infp, outfp):
+    for line in infp.readlines():
         if line[:8] == 'include ':
             file = line[8:-1]
-           process(open(file, 'r'))
+            process(open(file, 'rb'), outfp)
         else:
-            sys.stdout.write(line)
+            outfp.write(line)
 
-process(input)
+process(input, output)
 
 sys.exit(0)
 """)
@@ -75,10 +73,10 @@ kscan = Scanner(name = 'kfile',
 scanners = Environment().Dictionary('SCANNERS')
 env = Environment(SCANNERS = scanners + [kscan])
 
-env.Command('foo', 'foo.k', '%s build.py < $SOURCES > $TARGET')
+env.Command('foo', 'foo.k', '%s build.py $SOURCES $TARGET')
 
 bar_in = File('bar.in')
-env.Command('bar', bar_in, '%s build.py $SOURCES > $TARGET')
+env.Command('bar', bar_in, '%s build.py $SOURCES  $TARGET')
 bar_in.scanner_set(kscan)
 """ % (python, python))