diff options
author | William Deegan <bill@baddogconsulting.com> | 2017-02-28 04:14:44 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2017-02-28 04:14:44 (GMT) |
commit | 5573ade4379a99cfd4d321fb8501836385ab584d (patch) | |
tree | b76cd31a5b239aa49ed211476c8d22faec17b250 | |
parent | 7605860fff6a4d27b4bfc47bbe589e682b7e3d80 (diff) | |
download | SCons-5573ade4379a99cfd4d321fb8501836385ab584d.zip SCons-5573ade4379a99cfd4d321fb8501836385ab584d.tar.gz SCons-5573ade4379a99cfd4d321fb8501836385ab584d.tar.bz2 |
fixed for py3 & py2 compat. Also added DefaultEnvironment(tools=[]) to speed it up a bit. Perhaps more tests would benefit from such
-rw-r--r-- | test/Actions/function.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/test/Actions/function.py b/test/Actions/function.py index 941498b..5e5066f 100644 --- a/test/Actions/function.py +++ b/test/Actions/function.py @@ -72,15 +72,15 @@ def toto(header='%(header)s', trailer='%(trailer)s'): def foo(b=b): return %(nestedfuncexp)s f = open(str(target[0]),'wb') - f.write(header) + f.write(bytearray(header,'utf-8')) for d in env['ENVDEPS']: - f.write(bytearray(d+'%(separator)s')) - f.write(trailer+'\\n') - f.write(str(foo())+'\\n') - f.write(r.match('aaaa').group(1)+'\\n') + f.write(bytearray(d+'%(separator)s','utf-8')) + f.write(bytearray(trailer+'\\n','utf-8')) + f.write(bytearray(str(foo())+'\\n','utf-8')) + f.write(bytearray(r.match('aaaa').group(1)+'\\n','utf-8')) %(extracode)s try: - f.write(str(xarg)+'\\n') + f.write(bytearray(str(xarg),'utf-8')+b'\\n') except NameError: pass f.close() @@ -88,7 +88,6 @@ def toto(header='%(header)s', trailer='%(trailer)s'): return writeDeps ''' - exec( withClosure % optEnv ) genHeaderBld = SCons.Builder.Builder( @@ -100,7 +99,8 @@ genHeaderBld = SCons.Builder.Builder( suffix = '.gen.h' ) -env = Environment() +DefaultEnvironment(tools=[]) +env = Environment(tools=[]) env.Append(BUILDERS = {'GenHeader' : genHeaderBld}) envdeps = list(map(str, range(int(optEnv['NbDeps'])))) @@ -160,7 +160,7 @@ runtest('NbDeps=4', """Head:0:1:2:3:Tail\n18\naaa\n""") runtest('', """Head:0:1:Tail\n18\naaa\n""") sys.stdout.write('Changing the function code should cause a rebuild.\n') -runtest('extracode=f.write("XX\\n")', """Head:0:1:Tail\n18\naaa\nXX\n""") +runtest('extracode=f.write(bytearray("XX\\n","utf-8"))', """Head:0:1:Tail\n18\naaa\nXX\n""") runtest('extracode=a=2', """Head:0:1:Tail\n18\naaa\n""") runtest('', """Head:0:1:Tail\n18\naaa\n""") |