diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2020-01-20 15:04:16 -0500 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2020-01-26 07:51:16 -0500 |
commit | b74ece344fe6d40e1040670a12be1dde3adb71b2 (patch) | |
tree | 4a884bc30f7b91437066390139e242922be35322 /mesonbuild/interpreter.py | |
parent | dbad64cf34ba43b24dc2d71bd260f137acc37ea5 (diff) | |
download | meson-b74ece344fe6d40e1040670a12be1dde3adb71b2.zip meson-b74ece344fe6d40e1040670a12be1dde3adb71b2.tar.gz meson-b74ece344fe6d40e1040670a12be1dde3adb71b2.tar.bz2 |
Support multiple args to message() and warning()
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r-- | mesonbuild/interpreter.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 9f661b6..f1ed2d4 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -2858,13 +2858,7 @@ external dependencies (including libraries) must go to "dependencies".''') return False return self.add_languages(args, required) - def get_message_string_arg(self, node): - # reduce arguments again to avoid flattening posargs - (posargs, _) = self.reduce_arguments(node.args) - if len(posargs) != 1: - raise InvalidArguments('Expected 1 argument, got %d' % len(posargs)) - - arg = posargs[0] + def get_message_string_arg(self, arg): if isinstance(arg, list): argstr = stringifyUserArguments(arg) elif isinstance(arg, dict): @@ -2878,13 +2872,16 @@ external dependencies (including libraries) must go to "dependencies".''') return argstr + @noArgsFlattening @noKwargs def func_message(self, node, args, kwargs): - argstr = self.get_message_string_arg(node) - self.message_impl(argstr) + if len(args) > 1: + FeatureNew('message with more than one argument', '0.54.0').use(self.subproject) + args_str = [self.get_message_string_arg(i) for i in args] + self.message_impl(args_str) - def message_impl(self, argstr): - mlog.log(mlog.bold('Message:'), argstr) + def message_impl(self, args): + mlog.log(mlog.bold('Message:'), *args) @noArgsFlattening @permittedKwargs({'section', 'bool_yn'}) @@ -2928,11 +2925,14 @@ external dependencies (including libraries) must go to "dependencies".''') if main_summary: main_summary.dump() + @noArgsFlattening @FeatureNew('warning', '0.44.0') @noKwargs def func_warning(self, node, args, kwargs): - argstr = self.get_message_string_arg(node) - mlog.warning(argstr, location=node) + if len(args) > 1: + FeatureNew('warning with more than one argument', '0.54.0').use(self.subproject) + args_str = [self.get_message_string_arg(i) for i in args] + mlog.warning(*args_str, location=node) @noKwargs def func_error(self, node, args, kwargs): @@ -3234,10 +3234,10 @@ external dependencies (including libraries) must go to "dependencies".''') d = self.dependency_impl(name, display_name, kwargs) except Exception: if not_found_message: - self.message_impl(not_found_message) + self.message_impl([not_found_message]) raise if not d.found() and not_found_message: - self.message_impl(not_found_message) + self.message_impl([not_found_message]) return d def dependency_impl(self, name, display_name, kwargs): |