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
@@ -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"')
