Don't use os.path.isdir() because it can swallow errors related to filesystem/disk...
authorZac Medico <zmedico@gentoo.org>
Wed, 31 Jan 2007 22:46:33 +0000 (22:46 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 31 Jan 2007 22:46:33 +0000 (22:46 -0000)
svn path=/main/trunk/; revision=5852

pym/portage/__init__.py

index f58af8411cc992b9176e2721432703e2c6df2e8c..25c676f8ee8a6a3f4c77c6bf0385b1baa7794e86 100644 (file)
@@ -5309,8 +5309,14 @@ class vardbapi(dbapi):
 
        def _aux_get(self, mycpv, wants):
                mydir = os.path.join(self.root, VDB_PATH, mycpv)
-               if not os.path.isdir(mydir):
-                       raise KeyError(mycpv)
+               try:
+                       if not stat.S_ISDIR(os.stat(mydir).st_mode):
+                               raise KeyError(mycpv)
+               except OSError, e:
+                       if e.errno == errno.ENOENT:
+                               raise KeyError(mycpv)
+                       del e
+                       raise
                results = []
                for x in wants:
                        try: