In LinkageMap.rebuild(), immediately raise a CommandNotFound exception if
authorZac Medico <zmedico@gentoo.org>
Fri, 7 Nov 2008 22:18:33 +0000 (22:18 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 7 Nov 2008 22:18:33 +0000 (22:18 -0000)
scanelf is missing since otherwise it will lead to a KeyError later on
from findConsumers or findProviders. This will allow the caller to handle
the CommandNotFound exception if necessary, and skip any findConsumers or
findProviders since they won't be able to return valid results.

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

pym/portage/dbapi/vartree.py

index 5d6e8f57804307b72b9187f8f6b9a741892bbe84..110bcff4cc7dc4f858e5bd02f0ae4bb56efff835 100644 (file)
@@ -13,7 +13,8 @@ from portage.data import portage_gid, portage_uid, secpass
 from portage.dbapi import dbapi
 from portage.dep import use_reduce, paren_reduce, isvalidatom, \
        isjustname, dep_getkey, match_from_list
-from portage.exception import InvalidData, InvalidPackageName, \
+from portage.exception import CommandNotFound, \
+       InvalidData, InvalidPackageName, \
        FileNotFound, PermissionDenied, UnsupportedAPIException
 from portage.locks import lockdir, unlockdir
 from portage.output import bold, red, green
@@ -281,9 +282,9 @@ class LinkageMap(object):
                        try:
                                proc = subprocess.Popen(args, stdout=subprocess.PIPE)
                        except EnvironmentError, e:
-                               writemsg_level("\nUnable to execute %s: %s\n\n" % (args[0], e),
-                                       level=logging.ERROR, noiselevel=-1)
-                               del e
+                               if e.errno != errno.ENOENT:
+                                       raise
+                               raise CommandNotFound(args[0])
                        else:
                                for l in proc.stdout:
                                        l = l[3:].rstrip("\n")