aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonmain.py
diff options
context:
space:
mode:
authorElliott Sales de Andrade <quantum.analyst@gmail.com>2016-08-24 19:29:11 -0400
committerElliott Sales de Andrade <quantum.analyst@gmail.com>2016-08-27 18:29:55 -0400
commit4c71695e41a50dda3199d26ed7aedbaaf3150768 (patch)
tree8bd499a2a113c3da5c1dee8ed29f4b3c69d27dd7 /mesonbuild/mesonmain.py
parent7830cb61c39fbaf57933ac403dcdf5007667d87d (diff)
downloadmeson-4c71695e41a50dda3199d26ed7aedbaaf3150768.zip
meson-4c71695e41a50dda3199d26ed7aedbaaf3150768.tar.gz
meson-4c71695e41a50dda3199d26ed7aedbaaf3150768.tar.bz2
Use context manager for file I/O.
There are a few cases where a context manager cannot be used, such as the logger.
Diffstat (limited to 'mesonbuild/mesonmain.py')
-rw-r--r--mesonbuild/mesonmain.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py
index 65d979b..617704a 100644
--- a/mesonbuild/mesonmain.py
+++ b/mesonbuild/mesonmain.py
@@ -169,7 +169,8 @@ itself as required.'''
g.generate(intr)
g.run_postconf_scripts()
dumpfile = os.path.join(env.get_scratch_dir(), 'build.dat')
- pickle.dump(b, open(dumpfile, 'wb'))
+ with open(dumpfile, 'wb') as f:
+ pickle.dump(b, f)
# Write this last since we use the existence of this file to check if
# we generated the build file successfully, so we don't want an error
# that pops up during generation, post-conf scripts, etc to cause us to