diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2018-12-29 22:55:48 +0100 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2018-12-29 23:55:45 +0100 |
commit | c033af914ae706dfecc58213a4d756f16a21b8dc (patch) | |
tree | 77ae3f34ef4810c5cc4bf4ce27c523c109754732 /mesonbuild/environment.py | |
parent | 10ce5deb71a06a6f323516c68f7522c9d5ee7056 (diff) | |
download | meson-c033af914ae706dfecc58213a4d756f16a21b8dc.zip meson-c033af914ae706dfecc58213a4d756f16a21b8dc.tar.gz meson-c033af914ae706dfecc58213a4d756f16a21b8dc.tar.bz2 |
Disable mlog and don't require build directory for environment
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r-- | mesonbuild/environment.py | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 0bd2a8c..71f75f9 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -310,25 +310,32 @@ class Environment: def __init__(self, source_dir, build_dir, options): self.source_dir = source_dir self.build_dir = build_dir - self.scratch_dir = os.path.join(build_dir, Environment.private_dir) - self.log_dir = os.path.join(build_dir, Environment.log_dir) - os.makedirs(self.scratch_dir, exist_ok=True) - os.makedirs(self.log_dir, exist_ok=True) - try: - self.coredata = coredata.load(self.get_build_dir()) - self.first_invocation = False - except FileNotFoundError: - self.create_new_coredata(options) - 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) + + # Do not try to create build directories when build_dir is none. + # This reduced mode is used by the --buildoptions introspector + 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) + os.makedirs(self.scratch_dir, exist_ok=True) + os.makedirs(self.log_dir, exist_ok=True) + try: + self.coredata = coredata.load(self.get_build_dir()) + self.first_invocation = False + except FileNotFoundError: 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) self.exe_wrapper = None self.machines = MachineInfos() |