diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2022-01-21 14:21:32 -0500 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2022-01-26 14:49:38 -0500 |
commit | 88f8a8ea156b4839529221192819bde72a89a32d (patch) | |
tree | dddcf66afe26c8f5d63eb75a9b030c34f3449402 /mesonbuild/mcompile.py | |
parent | ab924fc1dedaaffbecad9155f7ba93eb5eda1e7d (diff) | |
download | meson-88f8a8ea156b4839529221192819bde72a89a32d.zip meson-88f8a8ea156b4839529221192819bde72a89a32d.tar.gz meson-88f8a8ea156b4839529221192819bde72a89a32d.tar.bz2 |
mcompile: fix broken codepaths and restore orphaned code
In commit 928078982c8643bffd95a8da06a1b4494fe87e2b a good error message
about the directory not being a valid build directory, was replaced by a
worse message.
In commit abaa980436f53100041bd5535589bb1c42019bd6 the error message was
replaced by a traceback when trying to load the coredata before checking
if it was a build directory.
Revert back to using the helper function with the good error message.
Reorganize code so that we check basic things first, and do less work
before detecting errors.
Fixes #9584
Diffstat (limited to 'mesonbuild/mcompile.py')
-rw-r--r-- | mesonbuild/mcompile.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/mesonbuild/mcompile.py b/mesonbuild/mcompile.py index ccb2f0b..fbdf92c 100644 --- a/mesonbuild/mcompile.py +++ b/mesonbuild/mcompile.py @@ -322,20 +322,18 @@ 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(): - raise MesonException(f'Directory {options.wd!r} does not seem to be a Meson build directory.') + validate_builddir(bdir) + if options.targets and options.clean: + raise MesonException('`TARGET` and `--clean` can\'t be used simultaneously') + + cdata = coredata.load(options.wd) b = build.load(options.wd) setup_vsenv(b.need_vsenv) cmd = [] # type: T.List[str] env = None # type: T.Optional[T.Dict[str, str]] - if options.targets and options.clean: - raise MesonException('`TARGET` and `--clean` can\'t be used simultaneously') - backend = cdata.get_option(mesonlib.OptionKey('backend')) assert isinstance(backend, str) if backend == 'ninja': |