diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2022-09-23 14:26:06 -0400 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2022-09-27 11:15:51 -0400 |
commit | 4fce954f9798f5872f110a93317d945b3496cc0e (patch) | |
tree | 87ba2160ff93aaad3bfa599966e30021ed9f03e0 /mesonbuild/mconf.py | |
parent | e1db50d4d9839cb29f73d7f4118f80262a2b47f3 (diff) | |
download | meson-4fce954f9798f5872f110a93317d945b3496cc0e.zip meson-4fce954f9798f5872f110a93317d945b3496cc0e.tar.gz meson-4fce954f9798f5872f110a93317d945b3496cc0e.tar.bz2 |
mconf: Use pager only when printing configuration
Fixes: #10845
Diffstat (limited to 'mesonbuild/mconf.py')
-rw-r--r-- | mesonbuild/mconf.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py index ad00874..ef176d7 100644 --- a/mesonbuild/mconf.py +++ b/mesonbuild/mconf.py @@ -36,7 +36,7 @@ def add_arguments(parser: 'argparse.ArgumentParser') -> None: parser.add_argument('builddir', nargs='?', default='.') parser.add_argument('--clearcache', action='store_true', default=False, help='Clear cached state (e.g. found dependencies)') - parser.add_argument('--no-pager', action='store_true', default=False, + parser.add_argument('--no-pager', action='store_false', dest='pager', help='Do not redirect output to a pager') def make_lower_case(val: T.Any) -> T.Union[str, T.List[T.Any]]: # T.Any because of recursion... @@ -205,7 +205,10 @@ class Conf: printable_value = '<inherited from main project>' self.add_option(str(root), o.description, printable_value, o.choices) - def print_conf(self): + def print_conf(self, pager: bool): + if pager: + mlog.start_pager() + def print_default_values_warning(): mlog.warning('The source directory instead of the build directory was specified.') mlog.warning('Only the default values for the project are printed, and all command line parameters are ignored.') @@ -297,13 +300,11 @@ class Conf: def run(options): coredata.parse_cmd_line_options(options) builddir = os.path.abspath(os.path.realpath(options.builddir)) - if not options.no_pager: - mlog.start_pager() c = None try: c = Conf(builddir) if c.default_values_only: - c.print_conf() + c.print_conf(options.pager) return 0 save = False @@ -315,7 +316,7 @@ def run(options): c.clear_cache() save = True else: - c.print_conf() + c.print_conf(options.pager) if save: c.save() mintro.update_build_options(c.coredata, c.build.environment.info_dir) |