equery list: do not raise GentoolkitNoMatches exception in quiet mode
authorPaul Varner <fuzzyray@gentoo.org>
Wed, 5 Jan 2011 19:26:40 +0000 (13:26 -0600)
committerPaul Varner <fuzzyray@gentoo.org>
Wed, 5 Jan 2011 19:26:40 +0000 (13:26 -0600)
pym/gentoolkit/equery/list_.py

index 941827f5b8ff5cac04221ba5075981e4a79c8500..8c4b8715faac798527c7d94f77546ceac5dbd4bf 100644 (file)
@@ -19,6 +19,7 @@ from getopt import gnu_getopt, GetoptError
 
 import gentoolkit
 import gentoolkit.pprinter as pp
+import gentoolkit.errors as errors
 from gentoolkit.equery import format_options, mod_usage, CONFIG
 from gentoolkit.helpers import get_installed_cpvs
 from gentoolkit.helpers import get_bintree_cpvs
@@ -191,7 +192,15 @@ def main(input_args):
                if not first_run:
                        print()
 
-               matches = query.smart_find(**QUERY_OPTS)
+               # if we are in quiet mode, do not raise GentoolkitNoMatches exception
+               # TODO: Return a non-zero exit status
+               try:
+                       matches = query.smart_find(**QUERY_OPTS)
+               except errors.GentoolkitNoMatches:
+                       if CONFIG['verbose']:
+                               raise
+                       else:
+                               continue
 
                # Find duplicate packages
                if QUERY_OPTS["duplicates"]: