aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2021-10-25 09:43:25 -0400
committerXavier Claessens <xclaesse@gmail.com>2021-10-26 10:59:13 -0400
commit6298e2907082aff0763a09165c6c2841ac869e2d (patch)
tree002f12edcb0f3a152cbfa17f56b896c224214660
parentecdf192f4642ac777fa2948b3fe8f236a3f4553c (diff)
downloadmeson-6298e2907082aff0763a09165c6c2841ac869e2d.zip
meson-6298e2907082aff0763a09165c6c2841ac869e2d.tar.gz
meson-6298e2907082aff0763a09165c6c2841ac869e2d.tar.bz2
message: Allow bool
It has always been working even if not documented and there is no reason to not accept it. However, change "True/False" to "true/false" to be consistent with meson language. Fixes: #9436
-rw-r--r--docs/yaml/functions/message.yaml6
-rw-r--r--mesonbuild/interpreter/interpreter.py4
2 files changed, 5 insertions, 5 deletions
diff --git a/docs/yaml/functions/message.yaml b/docs/yaml/functions/message.yaml
index d4ab085..9d832c1 100644
--- a/docs/yaml/functions/message.yaml
+++ b/docs/yaml/functions/message.yaml
@@ -4,11 +4,11 @@ description: This function prints its argument to stdout.
posargs:
text:
- type: str
- description: The message to print
+ type: str | int | bool | list[str | int | bool] | dict[str | int | bool]
+ description: The message to print.
varargs:
name: more_text
since: 0.54.0
- type: str
+ type: str | int | bool | list[str | int | bool] | dict[str | int | bool]
description: Additional text that will be printed separated by spaces.
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index bbe89fa..fd00e70 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -103,12 +103,12 @@ def stringifyUserArguments(args, quote=False):
elif isinstance(args, dict):
return '{%s}' % ', '.join(['{} : {}'.format(stringifyUserArguments(k, True), stringifyUserArguments(v, True)) for k, v in args.items()])
elif isinstance(args, bool):
- pass # bools are a type of int, make this fallthrough to the error case
+ return 'true' if args else 'false'
elif isinstance(args, int):
return str(args)
elif isinstance(args, str):
return f"'{args}'" if quote else args
- raise InvalidArguments('Function accepts only strings, integers, lists, dictionaries and lists thereof.')
+ raise InvalidArguments('Function accepts only strings, integers, bools, lists, dictionaries and lists thereof.')
class Summary:
def __init__(self, project_name, project_version):