aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJehan <jehan@girinstud.io>2017-07-01 21:43:15 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2017-07-02 10:08:08 -0400
commitd80787ae28af58dcce3cbdb086b80677c5c00389 (patch)
tree7281d71b985baac0845438e5cb8276f853b37913
parentf24a4e27ad4373ce8b079db6ebe67877f80d23ad (diff)
downloadmeson-d80787ae28af58dcce3cbdb086b80677c5c00389.zip
meson-d80787ae28af58dcce3cbdb086b80677c5c00389.tar.gz
meson-d80787ae28af58dcce3cbdb086b80677c5c00389.tar.bz2
Output an appropriate warning when a cross info file does not exist.
If making a typo, it used to output: > Cross info file must have either host or a target machine. This was not useful at all and looked like there could be a file format error or some other issue with the content. Let's have an appropriate error: > File not found: /some/path
-rw-r--r--mesonbuild/environment.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 1e4e04b..07489a1 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -907,7 +907,12 @@ class CrossBuildInfo:
def parse_datafile(self, filename):
config = configparser.ConfigParser()
- config.read(filename)
+ try:
+ f = open(filename, 'r')
+ config.read_file(f, filename)
+ f.close()
+ except FileNotFoundError:
+ raise EnvironmentException('File not found: %s.' % filename)
# This is a bit hackish at the moment.
for s in config.sections():
self.config[s] = {}