From: Brian Dolbec Date: Tue, 25 Jan 2011 17:00:31 +0000 (-0800) Subject: fix the setting of the quiet option properly this time X-Git-Tag: gentoolkit-0.3.0~19 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9ec42c9f0e5ba0d0f2439b08a25263df2d367dfa;p=gentoolkit.git fix the setting of the quiet option properly this time --- 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