Wrap possible exceptions raised by stat call in apply_secpass_permissions.
authorZac Medico <zmedico@gentoo.org>
Tue, 14 Mar 2006 00:47:15 +0000 (00:47 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 14 Mar 2006 00:47:15 +0000 (00:47 -0000)
svn path=/main/trunk/; revision=2872

pym/portage_util.py

index 205db9b36cca6426bf33f497076d44bafc62581e..7ffe381c4d8a9a79183fd746d881581b0c88cdc3 100644 (file)
@@ -494,7 +494,15 @@ def apply_secpass_permissions(filename, uid=-1, gid=-1, mode=0,
        unapplied."""
 
        if stat_cached is None:
-               stat_cached = os.stat(filename)
+               try:
+                       stat_cached = os.stat(filename)
+               except OSError, oe:
+                       if oe.errno == errno.EPERM:
+                               raise OperationNotPermitted(oe)
+                       elif oe.errno == errno.ENOENT:
+                               raise FileNotFound(oe)
+                       else:
+                               raise oe
 
        all_applied = True