diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 97aaa2795..b48868c9b 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -1175,22 +1175,15 @@ class MesonConfigFile: except Exception: raise EnvironmentException('Malformed value in cross file variable %s.' % entry) - if cls._ok_type(res): - section[entry] = res - elif isinstance(res, list): - for i in res: - if not self._ok_type(i): - raise EnvironmentException('Malformed value in cross file variable %s.' % entry) - section[entry] = res - else: - raise EnvironmentException('Malformed value in cross file variable %s.' % entry) + for i in (res if isinstance(res, list) else [res]): + if not isinstance(i, (str, int, bool)): + raise EnvironmentException('Malformed value in cross file variable %s.' % entry) + + section[entry] = res + out[s] = section return out - @classmethod - def _ok_type(cls, i): - return isinstance(i, (str, int, bool)) - class Properties: def __init__(self): self.properties = {}