Simplify config file checking code, inlining `_ok_type`

pull/4445/head
John Ericson 6 years ago committed by John Ericson
parent 2b22576fb6
commit edb3585b65
  1. 15
      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):
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
else:
raise EnvironmentException('Malformed value in cross file variable %s.' % entry)
out[s] = section
return out
@classmethod
def _ok_type(cls, i):
return isinstance(i, (str, int, bool))
class Properties:
def __init__(self):
self.properties = {}

Loading…
Cancel
Save