diff options
Diffstat (limited to 'test/Glob')
-rw-r--r-- | test/Glob/Repository.py | 8 | ||||
-rw-r--r-- | test/Glob/VariantDir.py | 16 | ||||
-rw-r--r-- | test/Glob/basic.py | 8 | ||||
-rw-r--r-- | test/Glob/exclude.py | 8 | ||||
-rw-r--r-- | test/Glob/source.py | 8 | ||||
-rw-r--r-- | test/Glob/strings.py | 8 | ||||
-rw-r--r-- | test/Glob/subdir.py | 8 | ||||
-rw-r--r-- | test/Glob/subst.py | 8 |
8 files changed, 36 insertions, 36 deletions
diff --git a/test/Glob/Repository.py b/test/Glob/Repository.py index 3308e62..714bafa 100644 --- a/test/Glob/Repository.py +++ b/test/Glob/Repository.py @@ -50,10 +50,10 @@ test.write(['repository', 'SConstruct'], """\ DefaultEnvironment(tools=[]) def cat(env, source, target): target = str(target[0]) - f = open(target, "wb") - for src in source: - f.write(open(str(src), "rb").read()) - f.close() + with open(target, "wb") as ofp: + for src in source: + with open(str(src), "rb") as ifp: + ofp.write(ifp.read()) # Verify that we can glob a repository-only Node that exists # only in memory, not on disk. diff --git a/test/Glob/VariantDir.py b/test/Glob/VariantDir.py index 3beb9ab..6340bb8 100644 --- a/test/Glob/VariantDir.py +++ b/test/Glob/VariantDir.py @@ -52,10 +52,10 @@ test.write(['src', 'SConscript'], """\ env = Environment(tools=[]) def concatenate(target, source, env): - fp = open(str(target[0]), 'wb') - for s in source: - fp.write(open(str(s), 'rb').read()) - fp.close() + with open(str(target[0]), 'wb') as ofp: + for s in source: + with open(str(s), 'rb') as ifp: + ofp.write(ifp.read()) env['BUILDERS']['Concatenate'] = Builder(action=concatenate) @@ -67,10 +67,10 @@ test.write(['src', 'sub1', 'SConscript'], """\ env = Environment(tools=[]) def concatenate(target, source, env): - fp = open(str(target[0]), 'wb') - for s in source: - fp.write(open(str(s), 'rb').read()) - fp.close() + with open(str(target[0]), 'wb') as ofp: + for s in source: + with open(str(s), 'rb') as ifp: + ofp.write(ifp.read()) env['BUILDERS']['Concatenate'] = Builder(action=concatenate) diff --git a/test/Glob/basic.py b/test/Glob/basic.py index ad998c3..5e5cdb5 100644 --- a/test/Glob/basic.py +++ b/test/Glob/basic.py @@ -37,10 +37,10 @@ DefaultEnvironment(tools=[]) env = Environment(tools=[]) def concatenate(target, source, env): - fp = open(str(target[0]), 'wb') - for s in source: - fp.write(open(str(s), 'rb').read()) - fp.close() + with open(str(target[0]), 'wb') as ofp: + for s in source: + with open(str(s), 'rb') as ifp: + ofp.write(ifp.read()) env['BUILDERS']['Concatenate'] = Builder(action=concatenate) diff --git a/test/Glob/exclude.py b/test/Glob/exclude.py index bc3e774..658d99a 100644 --- a/test/Glob/exclude.py +++ b/test/Glob/exclude.py @@ -40,10 +40,10 @@ DefaultEnvironment(tools=[]) env = Environment(tools=[]) def concatenate(target, source, env): - fp = open(str(target[0]), 'wb') - for s in source: - fp.write(open(str(s), 'rb').read()) - fp.close() + with open(str(target[0]), 'wb') as ofp: + for s in source: + with open(str(s), 'rb') as ifp: + ofp.write(ifp.read()) env['BUILDERS']['Concatenate'] = Builder(action=concatenate) diff --git a/test/Glob/source.py b/test/Glob/source.py index 3d40d05..33aff85 100644 --- a/test/Glob/source.py +++ b/test/Glob/source.py @@ -41,10 +41,10 @@ DefaultEnvironment(tools=[]) env = Environment(tools=[]) def concatenate(target, source, env): - fp = open(str(target[0]), 'wb') - for s in source: - fp.write(open(str(s), 'rb').read()) - fp.close() + with open(str(target[0]), 'wb') as ofp: + for s in source: + with open(str(s), 'rb') as ifp: + ofp.write(ifp.read()) env['BUILDERS']['Concatenate'] = Builder(action=concatenate) diff --git a/test/Glob/strings.py b/test/Glob/strings.py index 0780ace..2a4a624 100644 --- a/test/Glob/strings.py +++ b/test/Glob/strings.py @@ -49,10 +49,10 @@ test.write(['src', 'SConscript'], """\ env = Environment(tools=[]) def concatenate(target, source, env): - fp = open(str(target[0]), 'wb') - for s in source: - fp.write(open(str(s), 'rb').read()) - fp.close() + with open(str(target[0]), 'wb') as ofp: + for s in source: + with open(str(s), 'rb') as ifp: + ofp.write(ifp.read()) env['BUILDERS']['Concatenate'] = Builder(action=concatenate) diff --git a/test/Glob/subdir.py b/test/Glob/subdir.py index 1227788..22439f7 100644 --- a/test/Glob/subdir.py +++ b/test/Glob/subdir.py @@ -40,10 +40,10 @@ DefaultEnvironment(tools=[]) env = Environment(tools=[]) def concatenate(target, source, env): - fp = open(str(target[0]), 'wb') - for s in source: - fp.write(open(str(s), 'rb').read()) - fp.close() + with open(str(target[0]), 'wb') as ofp: + for s in source: + with open(str(s), 'rb') as ifp: + ofp.write(ifp.read()) env['BUILDERS']['Concatenate'] = Builder(action=concatenate) diff --git a/test/Glob/subst.py b/test/Glob/subst.py index 6a145f1..efbc916 100644 --- a/test/Glob/subst.py +++ b/test/Glob/subst.py @@ -38,10 +38,10 @@ DefaultEnvironment(tools=[]) env = Environment(tools=[], PATTERN = 'f*.in') def copy(target, source, env): - fp = open(str(target[0]), 'wb') - for s in source: - fp.write(open(str(s), 'rb').read()) - fp.close() + with open(str(target[0]), 'wb') as ofp: + for s in source: + with open(str(s), 'rb') as ifp: + ofp.write(ifp.read()) env['BUILDERS']['Copy'] = Builder(action=copy) |