def extract_variables(self, kwargs, argname='variables', list_new=False, dict_new=False):
    variables = kwargs.get(argname, {})
    if isinstance(variables, dict):
        if (dict_new and variables):
            FeatureNew.single_use(f'{argname} as dictionary', '0.56.0', self.subproject, location=self.current_node)
    else:
        varlist = mesonlib.stringlistify(variables)
        if list_new:
            FeatureNew.single_use(f'{argname} as list of strings', '0.56.0', self.subproject, location=self.current_node)
        variables = collections.OrderedDict()
        for v in varlist:
            try:
                (key, value) = v.split('=', 1)
            except ValueError:
                raise InterpreterException(f'Variable {v!r} must have a value separated by equals sign.')
            variables[key.strip()] = value.strip()
    for (k, v) in variables.items():
        if ((not k) or (not v)):
            raise InterpreterException('Empty variable name or value')
        if any((c.isspace() for c in k)):
            raise InterpreterException(f'Invalid whitespace in variable name "{k}"')
        if (not isinstance(v, str)):
            raise InterpreterException('variables values must be strings.')
    return variables
def extract_variables(self, kwargs, argname='variables', list_new=False, dict_new=False):
    variables = kwargs.get(argname, {})
    if isinstance(variables, dict):
        if (dict_new and variables):
            FeatureNew.single_use(f'{argname} as dictionary', '0.56.0', self.subproject, location=self.current_node)
    else:
        varlist = mesonlib.stringlistify(variables)
        if list_new:
            FeatureNew.single_use(f'{argname} as list of strings', '0.56.0', self.subproject, location=self.current_node)
        variables = collections.OrderedDict()
        for v in varlist:
            try:
                (key, value) = v.split('=', 1)
            except ValueError:
                raise InterpreterException(f'Variable {v!r} must have a value separated by equals sign.')
            variables[key.strip()] = value.strip()
    for (k, v) in variables.items():
        if ((not k) or (not v)):
            raise InterpreterException('Empty variable name or value')
        if any((c.isspace() for c in k)):
            raise InterpreterException(f'Invalid whitespace in variable name "{k}"')
        if (not isinstance(v, str)):
            raise InterpreterException('variables values must be strings.')
    return variables