diff options
author | Nicolas Schneider <nioncode+git@gmail.com> | 2019-01-05 22:12:02 +0100 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2019-01-06 19:41:24 -0500 |
commit | 3232f780d8c3baba0cbca3f9fea18d1a722bf957 (patch) | |
tree | 105cd5ec72000d7ed4d1dfe02e4d137bcbdc2648 /mesonbuild/mconf.py | |
parent | f658107a0e424ad3a9659a4b53f310dec9fae690 (diff) | |
download | meson-3232f780d8c3baba0cbca3f9fea18d1a722bf957.zip meson-3232f780d8c3baba0cbca3f9fea18d1a722bf957.tar.gz meson-3232f780d8c3baba0cbca3f9fea18d1a722bf957.tar.bz2 |
use same code for printing options in mconf and msetup
Also, options are now responsible for providing a suitable printable
representation of their value instead of handling this at the caller.
Diffstat (limited to 'mesonbuild/mconf.py')
-rw-r--r-- | mesonbuild/mconf.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py index 61bb74b..2863b0c 100644 --- a/mesonbuild/mconf.py +++ b/mesonbuild/mconf.py @@ -23,6 +23,15 @@ def add_arguments(parser): help='Clear cached state (e.g. found dependencies)') +def make_lower_case(val): + if isinstance(val, bool): + return str(val).lower() + elif isinstance(val, list): + return [make_lower_case(i) for i in val] + else: + return str(val) + + class ConfException(mesonlib.MesonException): pass @@ -50,14 +59,6 @@ class Conf: @staticmethod def print_aligned(arr): - def make_lower_case(val): - if isinstance(val, bool): - return str(val).lower() - elif isinstance(val, list): - return [make_lower_case(i) for i in val] - else: - return str(val) - if not arr: return @@ -104,10 +105,8 @@ class Conf: for k in sorted(options): o = options[k] d = o.description - v = o.value + v = o.printable_value() c = o.choices - if isinstance(o, coredata.UserUmaskOption): - v = v if isinstance(v, str) else format(v, '04o') arr.append({'name': k, 'descr': d, 'value': v, 'choices': c}) self.print_aligned(arr) |