diff options
Diffstat (limited to 'test/TARGET-dir.py')
-rw-r--r-- | test/TARGET-dir.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/test/TARGET-dir.py b/test/TARGET-dir.py index 9e99087..652cf77 100644 --- a/test/TARGET-dir.py +++ b/test/TARGET-dir.py @@ -43,9 +43,10 @@ test.subdir('src', 'build1', 'build2') test.write('SConstruct', """ def cat(env, source, target): target = str(target[0]) - f = open(target, "wb") - for src in source: - f.write(open(str(src), "rb").read()) + with open(target, "wb") as f: + for src in source: + with open(str(src), "rb") as ifp: + f.write(ifp.read()) f.close() env = Environment(CPPPATH='${TARGET.dir}') env.Append(BUILDERS = {'Cat' : Builder(action=cat)}) |