diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2015-10-04 04:02:17 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2015-10-04 04:02:17 +0300 |
commit | b197d9e2796874420e7ffc6f5dd66ac8b08bc56c (patch) | |
tree | 1e933b5bea09b0accebc4e41b2683032f64f5ef9 /mesonlib.py | |
parent | 50663144c37af5e0f411902eb3b799641daffa45 (diff) | |
download | meson-b197d9e2796874420e7ffc6f5dd66ac8b08bc56c.zip meson-b197d9e2796874420e7ffc6f5dd66ac8b08bc56c.tar.gz meson-b197d9e2796874420e7ffc6f5dd66ac8b08bc56c.tar.bz2 |
Can set compiler options with mesonconf.
Diffstat (limited to 'mesonlib.py')
-rw-r--r-- | mesonlib.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/mesonlib.py b/mesonlib.py index 0b200ac..0e31ef1 100644 --- a/mesonlib.py +++ b/mesonlib.py @@ -279,10 +279,17 @@ class UserBooleanOption(UserOption): super().__init__(name, description) self.set_value(value) + def tobool(self, thing): + if isinstance(thing, bool): + return thing + if thing.lower() == 'true': + return True + if thing.lower() == 'false': + return False + raise MesonException('Value %s is not boolean (true or false).' % thing) + def set_value(self, newvalue): - if not isinstance(newvalue, bool): - raise MesonException('Value "%s" for boolean option "%s" is not a boolean.' % (str(newvalue), self.name)) - self.value = newvalue + self.value = self.tobool(newvalue) def parse_string(self, valuestring): if valuestring == 'false': |