Bug #192298 - Handle PermissionDenied error in
authorZac Medico <zmedico@gentoo.org>
Wed, 26 Sep 2007 03:57:09 +0000 (03:57 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 26 Sep 2007 03:57:09 +0000 (03:57 -0000)
cache.update_eclasses(). (trunk r7769)

svn path=/main/branches/2.1.2/; revision=7809

pym/eclass_cache.py

index 91b98fec5902ff3df18f1754682d97b78b78017f..d2ff47f973a4521d234fc903923b051282bd6c41 100644 (file)
@@ -4,8 +4,9 @@
 # $Id$
 
 from portage_util import normalize_path, writemsg
-import os, sys
+import errno, os, sys
 from portage_data import portage_gid
+from portage_exception import PermissionDenied
 
 class cache:
        """
@@ -44,7 +45,19 @@ class cache:
                for x in [normalize_path(os.path.join(y,"eclass")) for y in self.porttrees]:
                        if not os.path.isdir(x):
                                continue
-                       for y in [y for y in os.listdir(x) if y.endswith(".eclass")]:
+                       eclass_filenames = []
+                       try:
+                               for y in os.listdir(x):
+                                       if y.endswith(".eclass"):
+                                               eclass_filenames.append(y)
+                       except OSError, e:
+                               if e.errno == errno.ENOENT:
+                                       del e
+                                       continue
+                               elif e.errno == PermissionDenied.errno:
+                                       raise PermissionDenied(x)
+                               raise
+                       for y in eclass_filenames:
                                try:
                                        mtime = long(os.stat(os.path.join(x, y)).st_mtime)
                                except OSError: