aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2023-03-28 08:43:15 -0400
committerEli Schwartz <eschwartz@archlinux.org>2023-03-30 17:10:53 -0400
commit0418a40e68704e2ad36148eb72e92a1206de72dd (patch)
treece86b96a61bb87379e481a3b9f8df499711bbb10 /mesonbuild
parentad151d9f1123e84fea055848867c33bc965307f8 (diff)
downloadmeson-0418a40e68704e2ad36148eb72e92a1206de72dd.zip
meson-0418a40e68704e2ad36148eb72e92a1206de72dd.tar.gz
meson-0418a40e68704e2ad36148eb72e92a1206de72dd.tar.bz2
msetup: use more consistent exceptions on exit
- MesonException for errors is clearer than SystemExit('error message') and provides meson-formatted "ERROR: ..." - `raise SystemExit` with no parameter isn't obvious that it intends to exit successfully While clarifying the latter, it was observed to cause test_preprocessor_checks_CPPFLAGS() failure to be ignored. That test checks get_define() on both c and cpp compilers, which means we need to define either CPPFLAGS or both CFLAGS+CXXFLAGS.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/msetup.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/mesonbuild/msetup.py b/mesonbuild/msetup.py
index d824e1f..166f7ef 100644
--- a/mesonbuild/msetup.py
+++ b/mesonbuild/msetup.py
@@ -165,16 +165,21 @@ class MesonApp:
has_partial_build = os.path.isdir(priv_dir)
if has_valid_build:
if not reconfigure and not wipe:
- print('Directory already configured.\n'
- '\nJust run your build command (e.g. ninja) and Meson will regenerate as necessary.\n'
+ print('Directory already configured.\n\n'
+ 'Just run your build command (e.g. ninja) and Meson will regenerate as necessary.\n'
'If ninja fails, run "ninja reconfigure" or "meson setup --reconfigure"\n'
- 'to force Meson to regenerate.\n'
- '\nIf build failures persist, run "meson setup --wipe" to rebuild from scratch\n'
- 'using the same options as passed when configuring the build.'
- '\nTo change option values, run "meson configure" instead.')
- raise SystemExit
+ 'to force Meson to regenerate.\n\n'
+ 'If build failures persist, run "meson setup --wipe" to rebuild from scratch\n'
+ 'using the same options as passed when configuring the build.\n'
+ 'To change option values, run "meson configure" instead.')
+ # FIXME: This returns success and ignores new option values from CLI.
+ # We should either make this a hard error, or update options and
+ # return success.
+ # Note that making this an error would not be backward compatible (and also isn't
+ # universally agreed on): https://github.com/mesonbuild/meson/pull/4249.
+ raise SystemExit(0)
elif not has_partial_build and 'MESON_RUNNING_IN_PROJECT_TESTS' not in os.environ:
- raise SystemExit(f'Directory is not empty and does not contain a previous build:\n{build_dir}')
+ raise MesonException(f'Directory is not empty and does not contain a previous build:\n{build_dir}')
return src_dir, build_dir
def generate(self) -> None: