summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-06-12 00:13:46 +0000
committerZac Medico <zmedico@gentoo.org>2006-06-12 00:13:46 +0000
commitbacb3f60e57b7fec3e3143b1e9312debceaf3471 (patch)
tree1e1cb8700c4499ac9cf94aabbe3253e13267dc70
parent495b89a457686440e2619d6e7ad977c14f939a4a (diff)
downloadportage-bacb3f60e57b7fec3e3143b1e9312debceaf3471.tar.gz
portage-bacb3f60e57b7fec3e3143b1e9312debceaf3471.tar.bz2
portage-bacb3f60e57b7fec3e3143b1e9312debceaf3471.zip
Wrap more exceptions in ensure_dirs().
svn path=/main/trunk/; revision=3494
-rw-r--r--pym/portage_util.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/pym/portage_util.py b/pym/portage_util.py
index e9e84e72d..b08187ad4 100644
--- a/pym/portage_util.py
+++ b/pym/portage_util.py
@@ -3,6 +3,7 @@
# $Id$
from portage_exception import PortageException, FileNotFound, OperationNotPermitted, ReadOnlyFileSystem
+import portage_exception
import sys,string,shlex,os,errno
try:
@@ -722,10 +723,15 @@ def ensure_dirs(dir_path, *args, **kwargs):
os.makedirs(dir_path)
created_dir = True
except OSError, oe:
+ func_call = "makedirs('%s')" % dir_path
if errno.EEXIST == oe.errno:
pass
- elif oe.errno in (errno.EPERM, errno.EROFS):
- raise portage_exception.OperationNotPermitted(str(oe))
+ elif oe.errno == errno.EPERM:
+ raise OperationNotPermitted(func_call)
+ elif oe.errno == errno.EACCES:
+ raise PermissionDenied(func_call)
+ elif oe.errno == errno.EROFS:
+ raise ReadOnlyFileSystem(func_call)
else:
raise
perms_modified = apply_permissions(dir_path, *args, **kwargs)