summaryrefslogtreecommitdiffstats
path: root/Lib/distutils
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2010-11-06 04:53:42 (GMT)
committerÉric Araujo <merwok@netwok.org>2010-11-06 04:53:42 (GMT)
commite9954b56f4b119d5fef94ac05511f4a34f67adca (patch)
treee9fd0d2add39a39c2b17474375fe9096e7263461 /Lib/distutils
parente28665aa8ebbb452dba5e7e95a7ecd167f9fdb69 (diff)
downloadcpython-e9954b56f4b119d5fef94ac05511f4a34f67adca.zip
cpython-e9954b56f4b119d5fef94ac05511f4a34f67adca.tar.gz
cpython-e9954b56f4b119d5fef94ac05511f4a34f67adca.tar.bz2
Merged revisions 86244 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r86244 | eric.araujo | 2010-11-06 05:48:05 +0100 (sam., 06 nov. 2010) | 3 lines Prevent race condition with mkdir in distutils. Patch by Arfrever on #9281. ........
Diffstat (limited to 'Lib/distutils')
-rw-r--r--Lib/distutils/dir_util.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/distutils/dir_util.py b/Lib/distutils/dir_util.py
index 5a96806..d687593 100644
--- a/Lib/distutils/dir_util.py
+++ b/Lib/distutils/dir_util.py
@@ -69,10 +69,11 @@ def mkpath(name, mode=0777, verbose=1, dry_run=0):
if not dry_run:
try:
os.mkdir(head, mode)
- created_dirs.append(head)
except OSError, exc:
- raise DistutilsFileError, \
- "could not create '%s': %s" % (head, exc[-1])
+ if not (exc.errno == errno.EEXIST and os.path.isdir(head)):
+ raise DistutilsFileError(
+ "could not create '%s': %s" % (head, exc.args[-1]))
+ created_dirs.append(head)
_path_created[abs_head] = 1
return created_dirs