summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/DSUFFIXES.py4
-rw-r--r--test/DVIPDF/DVIPDFFLAGS.py4
-rw-r--r--test/Value.py4
-rw-r--r--test/explain/get_csig.py2
-rw-r--r--test/gnutools.py46
5 files changed, 30 insertions, 30 deletions
diff --git a/test/DSUFFIXES.py b/test/DSUFFIXES.py
index bc441a5..46bdf83 100644
--- a/test/DSUFFIXES.py
+++ b/test/DSUFFIXES.py
@@ -38,8 +38,8 @@ test.write('mydc.py', r"""
import sys
def do_file(outf, inf):
for line in open(inf, 'rb').readlines():
- if line[:7] == 'import ':
- do_file(outf, line[7:-2]+'.d')
+ if line[:7] == b'import ':
+ do_file(outf, line[7:-2] + b'.d')
else:
outf.write(line)
outf = open(sys.argv[1], 'wb')
diff --git a/test/DVIPDF/DVIPDFFLAGS.py b/test/DVIPDF/DVIPDFFLAGS.py
index b8c53c9..30d0e4f 100644
--- a/test/DVIPDF/DVIPDFFLAGS.py
+++ b/test/DVIPDF/DVIPDFFLAGS.py
@@ -55,7 +55,7 @@ base_name = os.path.splitext(arg[0])[0]
infile = open(arg[0], 'r')
out_file = open(base_name+'.dvi', 'w')
for l in infile.readlines():
- if l[:6] != '#latex':
+ if l[:6] != b'#latex':
out_file.write(l)
sys.exit(0)
""")
@@ -114,7 +114,7 @@ if dvipdf and tex:
test.write("wrapper.py", """import os
import sys
cmd = " ".join(sys.argv[1:])
-open('%s', 'ab').write("%%s\\n" %% cmd)
+open('%s', 'a').write("%%s\\n" %% cmd)
os.system(cmd)
""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
diff --git a/test/Value.py b/test/Value.py
index 7abe758..34b036b 100644
--- a/test/Value.py
+++ b/test/Value.py
@@ -59,7 +59,7 @@ env.B('f3.out', Value(C))
env.S('f4.out', Value(L))
def create_value (target, source, env):
- target[0].write(source[0].get_contents ())
+ target[0].write(source[0].get_contents())
def create_value_file (target, source, env):
open(str(target[0]), 'wb').write(source[0].read())
@@ -75,7 +75,7 @@ env.B3('f5.out', V)
test.write('put.py', """\
import os
import sys
-open(sys.argv[-1],'wb').write(" ".join(sys.argv[1:-2]))
+open(sys.argv[-1],'w').write(" ".join(sys.argv[1:-2]))
""")
# Run all of the tests with both types of source signature
diff --git a/test/explain/get_csig.py b/test/explain/get_csig.py
index d35a315..8a0266a 100644
--- a/test/explain/get_csig.py
+++ b/test/explain/get_csig.py
@@ -43,7 +43,7 @@ env = Environment()
def action( source, target, env ):
target[0].get_csig()
- f = open( str(target[0]), 'w' )
+ f = open( str(target[0]), 'wb' )
for s in source:
f.write( s.get_contents() )
f.close()
diff --git a/test/gnutools.py b/test/gnutools.py
index b0ebc1c..65d699b 100644
--- a/test/gnutools.py
+++ b/test/gnutools.py
@@ -49,11 +49,11 @@ cmd_opts, args = getopt.getopt(sys.argv[1:], 'f:s:co:', [])
output = None
opt_string = ''
for opt, arg in cmd_opts:
- if opt == '-o': output = open(arg, 'wb')
+ if opt == '-o': output = open(arg, 'w')
else: opt_string = opt_string + ' ' + opt + arg
output.write('gcc ' + opt_string + '\\n')
for a in args:
- contents = open(a, 'rb').read()
+ contents = open(a, 'r').read()
output.write(contents)
output.close()
sys.exit(0)
@@ -66,11 +66,11 @@ cmd_opts, args = getopt.getopt(sys.argv[1:], 'f:s:co:', [])
output = None
opt_string = ''
for opt, arg in cmd_opts:
- if opt == '-o': output = open(arg, 'wb')
+ if opt == '-o': output = open(arg, 'w')
else: opt_string = opt_string + ' ' + opt + arg
output.write('g++ ' + opt_string + '\\n')
for a in args:
- contents = open(a, 'rb').read()
+ contents = open(a, 'r').read()
output.write(contents)
output.close()
sys.exit(0)
@@ -116,31 +116,31 @@ test.run(chdir='work1')
def testObject(test, obj, expect):
contents = test.read(test.workpath('work1', obj))
- line1 = contents.split('\n')[0]
- actual = ' '.join(line1.split())
+ line1 = contents.split(b'\n')[0]
+ actual = b' '.join(line1.split())
if not expect == actual:
print("%s: %s != %s\n" % (obj, repr(expect), repr(actual)))
test.fail_test()
if sys.platform in ('win32', 'cygwin'):
- c_fpic = ''
+ c_fpic = b''
else:
- c_fpic = ' -fPIC'
-
-testObject(test, 'cfile1.o', 'gcc -c')
-testObject(test, 'cfile2.o', 'gcc -c')
-testObject(test, 'cppfile1.o', 'g++ -c')
-testObject(test, 'cppfile2.o', 'g++ -c')
-testObject(test, 'cfile1.os', 'gcc -c' + c_fpic)
-testObject(test, 'cfile2.os', 'gcc -c' + c_fpic)
-testObject(test, 'cppfile1.os', 'g++ -c' + c_fpic)
-testObject(test, 'cppfile2.os', 'g++ -c' + c_fpic)
-testObject(test, 'c-only' + _exe, 'gcc')
-testObject(test, 'cpp-only' + _exe, 'g++')
-testObject(test, 'c-and-cpp' + _exe, 'g++')
-testObject(test, dll('c-only'), 'gcc -shared')
-testObject(test, dll('cpp-only'), 'g++ -shared')
-testObject(test, dll('c-and-cpp'), 'g++ -shared')
+ c_fpic = b' -fPIC'
+
+testObject(test, 'cfile1.o', b'gcc -c')
+testObject(test, 'cfile2.o', b'gcc -c')
+testObject(test, 'cppfile1.o', b'g++ -c')
+testObject(test, 'cppfile2.o', b'g++ -c')
+testObject(test, 'cfile1.os', b'gcc -c' + c_fpic)
+testObject(test, 'cfile2.os', b'gcc -c' + c_fpic)
+testObject(test, 'cppfile1.os', b'g++ -c' + c_fpic)
+testObject(test, 'cppfile2.os', b'g++ -c' + c_fpic)
+testObject(test, 'c-only' + _exe, b'gcc')
+testObject(test, 'cpp-only' + _exe, b'g++')
+testObject(test, 'c-and-cpp' + _exe, b'g++')
+testObject(test, dll('c-only'), b'gcc -shared')
+testObject(test, dll('cpp-only'), b'g++ -shared')
+testObject(test, dll('c-and-cpp'), b'g++ -shared')
test.pass_test()