Make ensure_dirs() use os.path.isdir() to verify that the directory
authorZac Medico <zmedico@gentoo.org>
Wed, 1 Sep 2010 15:42:15 +0000 (08:42 -0700)
committerZac Medico <zmedico@gentoo.org>
Wed, 1 Sep 2010 15:42:15 +0000 (08:42 -0700)
exists when EISDIR is raised, since this is abnormal behavior.

pym/portage/util/__init__.py

index b11222d00c46d99c5e5f8701a681854f1ff0214e..aa37e8c3c8f697fed14a8e3a27a84161bdfbe06c 100644 (file)
@@ -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)