summaryrefslogtreecommitdiffstats
path: root/test/Scanner/exception.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/Scanner/exception.py')
-rw-r--r--test/Scanner/exception.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/Scanner/exception.py b/test/Scanner/exception.py
index 1a14152..ec19842 100644
--- a/test/Scanner/exception.py
+++ b/test/Scanner/exception.py
@@ -61,16 +61,17 @@ def process(outf, inf):
for line in inf.readlines():
if line[:8] == 'include ':
file = line[8:-1]
- process(outf, open(file, 'rb'))
+ with open(file, 'rb') as ifp:
+ process(outf, ifp)
else:
outf.write(line)
def cat(env, source, target):
target = str(target[0])
- outf = open(target, 'wb')
- for src in source:
- process(outf, open(str(src), 'rb'))
- outf.close()
+ with open(target, 'wb') as outf:
+ for src in source:
+ with open(str(src), 'rb') as inf:
+ process(outf, inf)
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
env.Append(SCANNERS = [kscan])