Make the use_cache=0 listdir() implementation inside vardbapi.cpv_all()
authorZac Medico <zmedico@gentoo.org>
Fri, 30 May 2008 20:19:43 +0000 (20:19 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 30 May 2008 20:19:43 +0000 (20:19 -0000)
rains a PermissionDenied error when appropriate.

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

pym/portage/dbapi/vartree.py

index 8f89262311ef82c356f123909018a6f90cb2a6af..5c15393fb667b0f12057fe5283131d82cd92690c 100644 (file)
@@ -471,7 +471,10 @@ class vardbapi(dbapi):
                                try:
                                        return [x for x in os.listdir(p) \
                                                if os.path.isdir(os.path.join(p, x))]
-                               except EnvironmentError:
+                               except EnvironmentError, e:
+                                       if e.errno == PermissionDenied.errno:
+                                               raise PermissionDenied(p)
+                                       del e
                                        return []
 
                for x in listdir(basepath, EmptyOnError=1, ignorecvs=1, dirsonly=1):