summaryrefslogtreecommitdiff
path: root/main/SCsub
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2018-03-16 08:40:33 +0100
committerRémi Verschelde <rverschelde@gmail.com>2018-03-16 08:40:33 +0100
commitcc617dc5d117cb2c979de6fb76c64620ab7cf04f (patch)
tree8537cb8933dc7a843b1fe565fc8583f4e13e22ba /main/SCsub
parentf17c35b447e9aee8cf4480c14aefb812c9d8b535 (diff)
SCons: properly close files when reading controller mappings
Fixup to #17296.
Diffstat (limited to 'main/SCsub')
-rw-r--r--main/SCsub8
1 files changed, 4 insertions, 4 deletions
diff --git a/main/SCsub b/main/SCsub
index ab4016190d..dd16437d5c 100644
--- a/main/SCsub
+++ b/main/SCsub
@@ -74,10 +74,9 @@ def make_default_controller_mappings(target, source, env):
platform_mappings = OrderedDict()
for src in source:
src_path = src.srcnode().abspath
- f = open(src_path, "rb")
-
- # read mapping file and skip header
- mapping_file_lines = f.readlines()[2:]
+ with open(src_path, "rb") as f:
+ # read mapping file and skip header
+ mapping_file_lines = f.readlines()[2:]
current_platform = None
for line in mapping_file_lines:
@@ -123,6 +122,7 @@ def make_default_controller_mappings(target, source, env):
g.write("#endif\n")
g.write("};\n")
+ g.close()
env.main_sources = []
env.add_source_files(env.main_sources, "*.cpp")