Skip to content

Commit

Permalink
message: Allow bool
Browse files Browse the repository at this point in the history
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
  • Loading branch information
xclaesse committed Oct 25, 2021
1 parent 6ea4e21 commit 4c14954
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions docs/yaml/functions/message.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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. Before *0.54.0* only strings was accepted.

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.
4 changes: 2 additions & 2 deletions mesonbuild/interpreter/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 4c14954

Please sign in to comment.