aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/optinterpreter.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2021-08-27 11:39:21 -0400
committerXavier Claessens <xclaesse@gmail.com>2021-10-09 18:13:34 -0400
commita844e9bdb0ad89114e73c8ea9906606990fcfc51 (patch)
tree48b92596a0a9cc1c95dfea1fe5de9853b88a5420 /mesonbuild/optinterpreter.py
parent709d151eb944d764b35008ca3275b02bd16a765d (diff)
downloadmeson-a844e9bdb0ad89114e73c8ea9906606990fcfc51.zip
meson-a844e9bdb0ad89114e73c8ea9906606990fcfc51.tar.gz
meson-a844e9bdb0ad89114e73c8ea9906606990fcfc51.tar.bz2
optinterpreter: Add support for dictionaries
Diffstat (limited to 'mesonbuild/optinterpreter.py')
-rw-r--r--mesonbuild/optinterpreter.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/mesonbuild/optinterpreter.py b/mesonbuild/optinterpreter.py
index 72bf865..27bda2e 100644
--- a/mesonbuild/optinterpreter.py
+++ b/mesonbuild/optinterpreter.py
@@ -174,6 +174,13 @@ class OptionInterpreter:
lr = [self.reduce_single(curarg) for curarg in arg.args.arguments]
# mypy really struggles with recursive flattening, help it out
return T.cast(T.Sequence[T.Union[str, int, bool]], lr)
+ elif isinstance(arg, mparser.DictNode):
+ d = {}
+ for k, v in arg.args.kwargs.items():
+ if not isinstance(k, mparser.StringNode):
+ raise OptionException('Dictionary keys must be a string literal')
+ d[k.value] = self.reduce_single(v)
+ return d
elif isinstance(arg, mparser.UMinusNode):
res = self.reduce_single(arg.value)
if not isinstance(res, (int, float)):