diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2024-08-27 08:53:45 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2025-04-03 12:27:07 -0700 |
commit | d332a122c86ab64b644c05242aadc3a668e93e7a (patch) | |
tree | 23bf0d69c3e8f062c92bde12394715899ba616e1 | |
parent | 5d9b9739ddc34a9db966a0034ab5ffb652ec4f56 (diff) | |
download | meson-d332a122c86ab64b644c05242aadc3a668e93e7a.zip meson-d332a122c86ab64b644c05242aadc3a668e93e7a.tar.gz meson-d332a122c86ab64b644c05242aadc3a668e93e7a.tar.bz2 |
environment: build_dir is allowed to be None in the initializer
But we really expect it to be a string once the initializer is done.
Therefore, let's set it to `''` just like we do with the scratchdir in
the case that it's set to None in the initializer.
-rw-r--r-- | mesonbuild/environment.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 92ce9c5..a0d98ae 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -566,12 +566,12 @@ class Environment: log_dir = 'meson-logs' info_dir = 'meson-info' - def __init__(self, source_dir: str, build_dir: str, cmd_options: coredata.SharedCMDOptions) -> None: + def __init__(self, source_dir: str, build_dir: T.Optional[str], cmd_options: coredata.SharedCMDOptions) -> None: self.source_dir = source_dir - self.build_dir = build_dir # 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.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) self.info_dir = os.path.join(build_dir, Environment.info_dir) @@ -600,6 +600,7 @@ class Environment: raise MesonException(f'{str(e)} Try regenerating using "meson setup --wipe".') else: # Just create a fresh coredata in this case + self.build_dir = '' self.scratch_dir = '' self.create_new_coredata(cmd_options) |