aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mcompile.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2021-10-25 10:04:54 -0400
committerEli Schwartz <eschwartz93@gmail.com>2021-10-25 19:14:01 -0400
commitabaa980436f53100041bd5535589bb1c42019bd6 (patch)
treeb956c229ea37880f476b658fada067f7f141eb85 /mesonbuild/mcompile.py
parent6ea4e21b6d4b093eea7a3de35941b53475a3b579 (diff)
downloadmeson-abaa980436f53100041bd5535589bb1c42019bd6.zip
meson-abaa980436f53100041bd5535589bb1c42019bd6.tar.gz
meson-abaa980436f53100041bd5535589bb1c42019bd6.tar.bz2
mcompile: Load coredata first because it checks major version
Fixes: #9444
Diffstat (limited to 'mesonbuild/mcompile.py')
-rw-r--r--mesonbuild/mcompile.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/mesonbuild/mcompile.py b/mesonbuild/mcompile.py
index 146ea13..c1b5a2c 100644
--- a/mesonbuild/mcompile.py
+++ b/mesonbuild/mcompile.py
@@ -44,14 +44,6 @@ def validate_builddir(builddir: Path) -> None:
'It is also possible that the build directory was generated with an old\n'
'meson version. Please regenerate it in this case.')
-def get_backend_from_coredata(builddir: Path) -> str:
- """
- Gets `backend` option value from coredata
- """
- backend = coredata.load(str(builddir)).get_option(mesonlib.OptionKey('backend'))
- assert isinstance(backend, str)
- return backend
-
def parse_introspect_data(builddir: Path) -> T.Dict[str, T.List[dict]]:
"""
Converts a List of name-to-dict to a dict of name-to-dicts (since names are not unique)
@@ -329,6 +321,7 @@ def add_arguments(parser: 'argparse.ArgumentParser') -> None:
)
def run(options: 'argparse.Namespace') -> int:
+ cdata = coredata.load(options.wd)
bdir = Path(options.wd)
buildfile = bdir / 'meson-private' / 'build.dat'
if not buildfile.is_file():
@@ -342,7 +335,8 @@ def run(options: 'argparse.Namespace') -> int:
if options.targets and options.clean:
raise MesonException('`TARGET` and `--clean` can\'t be used simultaneously')
- backend = get_backend_from_coredata(bdir)
+ backend = cdata.get_option(mesonlib.OptionKey('backend'))
+ assert isinstance(backend, str)
if backend == 'ninja':
cmd, env = get_parsed_args_ninja(options, bdir)
elif backend.startswith('vs'):