From cd1fea8798065decf3907642dde6d5d4c515cd4a Mon Sep 17 00:00:00 2001 From: Nico Date: Sat, 14 Nov 2015 20:23:25 +0100 Subject: [PATCH] upip: MaxOSX mkdir("/") returns EISDIR, and not EEXIST. Unlike Linux, which return EEXIST. This MacOSX behavior is not documented in the official documentation: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/mkdir.2.html (EISDIR isn't described as possible error for mkdir()!), but other projects had to apply similar workarounds, e.g.: https://github.com/janestreet/core/issues/7 . The issue appear to happen only for root directory path, but workaround is applied conservatively just in case. --- upip/upip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upip/upip.py b/upip/upip.py index d88fde9b..2c612826 100644 --- a/upip/upip.py +++ b/upip/upip.py @@ -56,7 +56,7 @@ def _makedirs(name, mode=0o777): os.mkdir(s) ret = True except OSError as e: - if e.args[0] != errno.EEXIST: + if e.args[0] != errno.EEXIST and e.args[0] != errno.EISDIR: raise ret = False return ret