diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2014-01-05 23:15:05 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2014-01-05 23:15:05 +0200 |
commit | 239f0696fdf359993dbde61826f752eea1477106 (patch) | |
tree | 60d8bd08bbc48f249111faf69dd6a7a8f2cef1ae /mesonconf.py | |
parent | abcc846de962306765de8fda54663b2c77c5ec92 (diff) | |
download | meson-239f0696fdf359993dbde61826f752eea1477106.zip meson-239f0696fdf359993dbde61826f752eea1477106.tar.gz meson-239f0696fdf359993dbde61826f752eea1477106.tar.bz2 |
Can set user options.
Diffstat (limited to 'mesonconf.py')
-rwxr-xr-x | mesonconf.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/mesonconf.py b/mesonconf.py index 657168c..332b545 100755 --- a/mesonconf.py +++ b/mesonconf.py @@ -17,7 +17,7 @@ import sys, os import pickle from optparse import OptionParser -import coredata +import coredata, optinterpreter from meson import build_types usage_info = '%prog [build dir] [set commands]' @@ -82,6 +82,22 @@ class Conf: self.coredata.use_pch = self.tobool(v) elif k == 'unity': self.coredata.unity = self.tobool(v) + else: + if k not in self.coredata.user_options: + raise ConfException('Unknown option %s.' % k) + tgt = self.coredata.user_options[k] + if isinstance(tgt, optinterpreter.UserBooleanOption): + tgt.set_value(self.tobool(v)) + elif isinstance(tgt, optinterpreter.UserComboOption): + try: + tgt.set_value(v) + except optinterpreter.OptionException: + raise ConfException('Value of %s must be one of %s.' % + (k, tgt.choices)) + elif isinstance(tgt, optinterpreter.UserStringOption): + tgt.set_value(v) + else: + raise ConfException('Internal error, unknown option type.') def print_conf(self): print('Core properties\n') |