Bug #288551 - Fix portageq to handle portage.exception.AmbiguousPackageName
authorZac Medico <zmedico@gentoo.org>
Sun, 11 Oct 2009 23:01:00 +0000 (23:01 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 11 Oct 2009 23:01:00 +0000 (23:01 -0000)
instead of ValueError.

svn path=/main/trunk/; revision=14577

bin/portageq

index cea14231fe9d88eb68a165998064ef1c554c3686..723d12046f540a7aa40e8246ceb04cdbe609bde3 100755 (executable)
@@ -626,11 +626,7 @@ def main():
        except portage.exception.ParseError as e:
                sys.stderr.write("%s\n" % str(e))
                sys.exit(1)
-       except ValueError as e:
-               if not e.args or \
-                       not hasattr(e.args[0], "__len__") or \
-                       len(e.args[0]) < 2:
-                       raise
+       except portage.exception.AmbiguousPackageName as e:
                # Multiple matches thrown from cpv_expand
                pkgs = e.args[0]
                # An error has occurred so we writemsg to stderr and exit nonzero.