summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-09-01 08:42:15 -0700
committerZac Medico <zmedico@gentoo.org>2010-09-01 08:42:15 -0700
commite88c73abd34c44e6b7ca897dfa2d1fc6be320f1f (patch)
tree30cda3f94764c5f2f4813dfb05ac790a0c629d8e
parent256d04c35bdd166aaf7bc46d93bb9246cd064bb7 (diff)
downloadportage-e88c73abd34c44e6b7ca897dfa2d1fc6be320f1f.tar.gz
portage-e88c73abd34c44e6b7ca897dfa2d1fc6be320f1f.tar.bz2
portage-e88c73abd34c44e6b7ca897dfa2d1fc6be320f1f.zip
Make ensure_dirs() use os.path.isdir() to verify that the directory
exists when EISDIR is raised, since this is abnormal behavior.
-rw-r--r--pym/portage/util/__init__.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index b11222d00..aa37e8c3c 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -1054,13 +1054,14 @@ def ensure_dirs(dir_path, **kwargs):
created_dir = True
except OSError as oe:
func_call = "makedirs('%s')" % dir_path
- if oe.errno in (errno.EEXIST, errno.EISDIR):
- # Bug 187518 - sometimes mkdir raises EISDIR on FreeBSD
+ if oe.errno in (errno.EEXIST,):
pass
else:
if os.path.isdir(dir_path):
# NOTE: DragonFly raises EPERM for makedir('/')
# and that is supposed to be ignored here.
+ # Also, sometimes mkdir raises EISDIR on FreeBSD
+ # and we want to ignore that too (bug #187518).
pass
elif oe.errno == errno.EPERM:
raise OperationNotPermitted(func_call)