aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2017-04-07 09:16:11 +0200
committerSimon Warta <[email protected]>2017-04-07 09:16:11 +0200
commite2ba1fd94b69a39d2f97068989538897f1e83151 (patch)
tree106accc8fd39c0c4f51ab3a4b12a2352e5952652
parenta8a0fce61f3ef4d4596998df1bc509bfc5f27f8e (diff)
Iterate over open sources file in amalgamation generator
-rwxr-xr-xconfigure.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/configure.py b/configure.py
index a4e3975ff..6605e2392 100755
--- a/configure.py
+++ b/configure.py
@@ -2392,21 +2392,21 @@ class AmalgamationGenerator(object):
tgt = self._target_for_module(mod)
for src in sorted(mod.source):
- contents = open(src, 'r').readlines()
- for line in contents:
- if AmalgamationGenerator.botan_include_matcher.search(line):
- continue
-
- match = AmalgamationGenerator.any_include_matcher.search(line)
- if match:
- header = match.group(1)
- if header in headers_written[tgt]:
+ with open(src, 'r') as f:
+ for line in f:
+ if AmalgamationGenerator.botan_include_matcher.search(line):
continue
- amalgamation_files[tgt].write(line)
- headers_written[tgt].add(header)
- else:
- amalgamation_files[tgt].write(line)
+ match = AmalgamationGenerator.any_include_matcher.search(line)
+ if match:
+ header = match.group(1)
+ if header in headers_written[tgt]:
+ continue
+
+ amalgamation_files[tgt].write(line)
+ headers_written[tgt].add(header)
+ else:
+ amalgamation_files[tgt].write(line)
for f in amalgamation_files.values():
f.close()