diff options
author | Mathieu Duponchelle <mathieu@centricular.com> | 2018-04-28 01:56:56 +0200 |
---|---|---|
committer | Mathieu Duponchelle <mathieu@centricular.com> | 2018-05-20 21:19:44 +0200 |
commit | ecb88380827e33161a29c5ca6f3448a6cdd557a5 (patch) | |
tree | e31280e1cf6dee24fccd716c41ccef08d437164a /mesonbuild/interpreter.py | |
parent | 7e8c099387ffcdfbdc55e3ef550cf7e8ab0e848d (diff) | |
download | meson-ecb88380827e33161a29c5ca6f3448a6cdd557a5.zip meson-ecb88380827e33161a29c5ca6f3448a6cdd557a5.tar.gz meson-ecb88380827e33161a29c5ca6f3448a6cdd557a5.tar.bz2 |
Add new built-in type, dict
For now dicts are immutable, and do not expose any methods,
they however support "native" syntax such as [] lookup,
and foreach iterating, and can be printed.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r-- | mesonbuild/interpreter.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 49e9381..4118a96 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -45,6 +45,8 @@ permitted_method_kwargs = { def stringifyUserArguments(args): if isinstance(args, list): return '[%s]' % ', '.join([stringifyUserArguments(x) for x in args]) + elif isinstance(args, dict): + return '{%s}' % ', '.join(['%s : %s' % (stringifyUserArguments(k), stringifyUserArguments(v)) for k, v in args.items()]) elif isinstance(args, int): return str(args) elif isinstance(args, str): @@ -2273,6 +2275,8 @@ to directly access options of other subprojects.''') arg = posargs[0] if isinstance(arg, list): argstr = stringifyUserArguments(arg) + elif isinstance(arg, dict): + argstr = stringifyUserArguments(arg) elif isinstance(arg, str): argstr = arg elif isinstance(arg, int): |