From 7e417ac0fa20ce8ddc3018f7c947c352730bc518 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 11 Aug 2021 10:48:58 -0700 Subject: build: Allow `Dict[OptionKey, str` in parse_overrides We really want to move all of this option handling into the interpreter through the typed_kwargs, this is the first step to that --- mesonbuild/build.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'mesonbuild/build.py') diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 576bb03..e5900ac 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -611,8 +611,15 @@ class Target(HoldableObject): @staticmethod def parse_overrides(kwargs: T.Dict[str, T.Any]) -> T.Dict[OptionKey, str]: + opts = kwargs.get('override_options', []) + + # In this case we hav ean already parsed and ready to go dictionary + # provided by typed_kwargs + if isinstance(opts, dict): + return T.cast(T.Dict[OptionKey, str], opts) + result: T.Dict[OptionKey, str] = {} - overrides = stringlistify(kwargs.get('override_options', [])) + overrides = stringlistify(opts) for o in overrides: if '=' not in o: raise InvalidArguments('Overrides must be of form "key=value"') -- cgit v1.1