aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/environment.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r--mesonbuild/environment.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index b0002a0..a6da3f9 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -909,9 +909,8 @@ class CrossBuildInfo:
def parse_datafile(self, filename):
config = configparser.ConfigParser()
try:
- f = open(filename, 'r')
- config.read_file(f, filename)
- f.close()
+ with open(filename, 'r') as f:
+ config.read_file(f, filename)
except FileNotFoundError:
raise EnvironmentException('File not found: %s.' % filename)
# This is a bit hackish at the moment.