From 9ec42c9f0e5ba0d0f2439b08a25263df2d367dfa Mon Sep 17 00:00:00 2001 From: Brian Dolbec Date: Tue, 25 Jan 2011 09:00:31 -0800 Subject: [PATCH] fix the setting of the quiet option properly this time --- pym/gentoolkit/analyse/analyse.py | 1 + pym/gentoolkit/analyse/base.py | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/pym/gentoolkit/analyse/analyse.py b/pym/gentoolkit/analyse/analyse.py index 7e47724..275bbc0 100644 --- a/pym/gentoolkit/analyse/analyse.py +++ b/pym/gentoolkit/analyse/analyse.py @@ -242,6 +242,7 @@ class Analyse(ModuleBase): """ query = self.main_setup(input_args) query = self.validate_query(query) + self.set_quiet(quiet) if query in ["use", "pkguse"]: self.analyse_flags(query) elif query in ["keywords"]: diff --git a/pym/gentoolkit/analyse/base.py b/pym/gentoolkit/analyse/base.py index 8fe38db..a3f3fed 100644 --- a/pym/gentoolkit/analyse/base.py +++ b/pym/gentoolkit/analyse/base.py @@ -36,6 +36,7 @@ class ModuleBase(object): self.module_opts = {} self.warning = None self.need_queries = True + self.saved_verbose = None def print_help(self, with_description=True): @@ -87,9 +88,21 @@ class ModuleBase(object): self.print_help(with_description=False) sys.exit(2) self.options[opt_name] = val - self.options['quiet'] = CONFIG["quiet"] - if self.options['quiet']: + + def set_quiet(self, quiet): + """sets the class option["quiet"] and option["verbose"] accordingly""" + if quiet == self.options['quiet']: + return + if self.saved_verbose: + # detected a switch + verbose = self.options['verbose'] + self.options['verbose'] = self.saved_verbose + self.saved_verbose = verbose + elif quiet: + self.saved_verbose = self.options['verbose'] self.options['verbose'] = False + self.options['quiet'] = quiet + return def validate_query(self, query, depth=0): """check that the query meets the modules TargetSpec -- 2.26.2