aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/environment.py
diff options
context:
space:
mode:
authorJohn Ericson <git@JohnEricson.me>2018-11-28 01:39:46 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2019-01-02 16:22:47 -0500
commitedb3585b65f6a1f36c3b4d39d92e049c49c8837e (patch)
treef994c548112f2053c33e165e774d08b11d372c4c /mesonbuild/environment.py
parent2b22576fb6a8bb52434068d95eff188a201e6bc5 (diff)
downloadmeson-edb3585b65f6a1f36c3b4d39d92e049c49c8837e.zip
meson-edb3585b65f6a1f36c3b4d39d92e049c49c8837e.tar.gz
meson-edb3585b65f6a1f36c3b4d39d92e049c49c8837e.tar.bz2
Simplify config file checking code, inlining `_ok_type`
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r--mesonbuild/environment.py19
1 files changed, 6 insertions, 13 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 97aaa27..b48868c 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 = {}