diff options
author | William Deegan <bill@baddogconsulting.com> | 2017-03-13 15:45:36 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2017-03-13 15:45:36 (GMT) |
commit | b46674b1dfcbdc9a1565ed989143dd7c70ef9b3d (patch) | |
tree | ff7cf2b8eed7e04d20bae1e0c4e7bb6ed9e0c57a | |
parent | 3fbb32bee52efaafff0109ade4533ea84b194eec (diff) | |
parent | be76fd27e51c16589d9167e279d4bb3820a8e5c1 (diff) | |
download | SCons-b46674b1dfcbdc9a1565ed989143dd7c70ef9b3d.zip SCons-b46674b1dfcbdc9a1565ed989143dd7c70ef9b3d.tar.gz SCons-b46674b1dfcbdc9a1565ed989143dd7c70ef9b3d.tar.bz2 |
fix mistaken head close
-rw-r--r-- | src/engine/SCons/Util.py | 2 | ||||
-rw-r--r-- | test/DSUFFIXES.py | 4 | ||||
-rw-r--r-- | test/DVIPDF/DVIPDFFLAGS.py | 4 | ||||
-rw-r--r-- | test/Ghostscript/GS.py | 12 | ||||
-rw-r--r-- | test/Value.py | 4 | ||||
-rw-r--r-- | test/explain/get_csig.py | 2 | ||||
-rw-r--r-- | test/gnutools.py | 46 |
7 files changed, 37 insertions, 37 deletions
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 52d7a50..a8a6990 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -308,7 +308,7 @@ def print_tree(root, child_func, prune=0, showtags=0, margin=[0], visited=None): ' N = no clean\n' + ' H = no cache\n' + '\n') - sys.stdout.write(u(legend)) + sys.stdout.write(legend) tags = ['['] tags.append(' E'[IDX(root.exists())]) 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/Ghostscript/GS.py b/test/Ghostscript/GS.py index daeea09..3f5aa58 100644 --- a/test/Ghostscript/GS.py +++ b/test/Ghostscript/GS.py @@ -38,8 +38,8 @@ test = TestSCons.TestSCons() test.write('mygs.py', r""" import os import sys -outfile = open(sys.argv[1], 'wb') -infile = open(sys.argv[2], 'rb') +outfile = open(sys.argv[1], 'w') +infile = open(sys.argv[2], 'r') for l in infile.readlines(): if l[:3] != '#ps': outfile.write(l) @@ -60,8 +60,8 @@ test.write('test1.ps', r"""This is a .ps test. test.run(arguments = '.', stderr = None) -test.fail_test(test.read('test1.pdf') != "This is a .ps test.\n") -test.fail_test(test.read('test2.pdf') != "This is a .ps test.\n") +test.must_match('test1.pdf', "This is a .ps test.\n", mode='r') +test.must_match('test2.pdf', "This is a .ps test.\n", mode='r') @@ -79,7 +79,7 @@ if gs: 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('\\', '\\\\')) @@ -110,7 +110,7 @@ bar.PDF(target = 'bar.pdf', source = 'bar.ps') test.run(arguments = 'bar.pdf', stderr = None) - test.fail_test(test.read('wrapper.out') != "%s -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=bar.pdf bar.ps\n" % gs_executable) + test.must_match('wrapper.out', "%s -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=bar.pdf bar.ps\n" % gs_executable, mode='r') test.fail_test(not os.path.exists(test.workpath('bar.pdf'))) 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() |