aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/environment.py
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2018-12-02 18:14:44 +0100
committerDaniel Mensinger <daniel@mensinger-ka.de>2019-01-06 12:19:29 +0100
commitd4ac832bf695f3c6b00c976d3706159b3616ec2f (patch)
tree6579080c20a439a41e710f335c2885f25bc57e1f /mesonbuild/environment.py
parente4e0e89ea81afc6b8d67f3822c2c4f26633a4e69 (diff)
downloadmeson-d4ac832bf695f3c6b00c976d3706159b3616ec2f.zip
meson-d4ac832bf695f3c6b00c976d3706159b3616ec2f.tar.gz
meson-d4ac832bf695f3c6b00c976d3706159b3616ec2f.tar.bz2
Split the monolithic introspection file into chunks
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r--mesonbuild/environment.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index b10f826..67b58bc 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -308,6 +308,7 @@ def search_version(text):
class Environment:
private_dir = 'meson-private'
log_dir = 'meson-logs'
+ info_dir = 'meson-info'
def __init__(self, source_dir, build_dir, options):
self.source_dir = source_dir
@@ -318,8 +319,10 @@ class Environment:
if build_dir is not None:
self.scratch_dir = os.path.join(build_dir, Environment.private_dir)
self.log_dir = os.path.join(build_dir, Environment.log_dir)
+ self.info_dir = os.path.join(build_dir, Environment.info_dir)
os.makedirs(self.scratch_dir, exist_ok=True)
os.makedirs(self.log_dir, exist_ok=True)
+ os.makedirs(self.info_dir, exist_ok=True)
try:
self.coredata = coredata.load(self.get_build_dir())
self.first_invocation = False
@@ -333,8 +336,16 @@ class Environment:
mlog.log('Reason:', mlog.red(str(e)))
coredata.read_cmd_line_file(self.build_dir, options)
self.create_new_coredata(options)
- else:
- raise e
+ except MesonException as e:
+ # If we stored previous command line options, we can recover from
+ # a broken/outdated coredata.
+ if os.path.isfile(coredata.get_cmd_line_file(self.build_dir)):
+ mlog.warning('Regenerating configuration from scratch.')
+ mlog.log('Reason:', mlog.red(str(e)))
+ coredata.read_cmd_line_file(self.build_dir, options)
+ self.create_new_coredata(options)
+ else:
+ raise e
else:
# Just create a fresh coredata in this case
self.create_new_coredata(options)