aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/msetup.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-12-19 09:44:50 -0800
committerXavier Claessens <xclaesse@gmail.com>2018-12-19 13:33:16 -0500
commitbd630fbe556ffabe572003bc0120870b34e5c053 (patch)
treea227dc44c5fd0104a54e29e9db528ea92d1da6a4 /mesonbuild/msetup.py
parent47b9c1a564756ac48a55da9a7c4d91787399c645 (diff)
downloadmeson-bd630fbe556ffabe572003bc0120870b34e5c053.zip
meson-bd630fbe556ffabe572003bc0120870b34e5c053.tar.gz
meson-bd630fbe556ffabe572003bc0120870b34e5c053.tar.bz2
msetup: Give a nice error message if cmd_line.txt cannot be read
As would happen if someone tried to manually call meson --wipe on a directory configured with a version < 0.49.0
Diffstat (limited to 'mesonbuild/msetup.py')
-rw-r--r--mesonbuild/msetup.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/mesonbuild/msetup.py b/mesonbuild/msetup.py
index f9a5e1c..63014f1 100644
--- a/mesonbuild/msetup.py
+++ b/mesonbuild/msetup.py
@@ -62,8 +62,13 @@ class MesonApp:
# restore that file if anything bad happens. For example if
# configuration fails we need to be able to wipe again.
filename = coredata.get_cmd_line_file(self.build_dir)
- with open(filename, 'r') as f:
- content = f.read()
+ try:
+ with open(filename, 'r') as f:
+ content = f.read()
+ except FileNotFoundError:
+ raise MesonException(
+ 'Cannot find cmd_line.txt. This is probably because this '
+ 'build directory was configured with a meson version < 0.49.0.')
coredata.read_cmd_line_file(self.build_dir, options)