summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/util.py
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-03-29 02:56:34 (GMT)
committerGreg Ward <gward@python.net>2000-03-29 02:56:34 (GMT)
commit739d06689dfd37e9233599c3fd95852bb96f71a1 (patch)
treec2ee441489626f8fef012a687d3aa622b46f1009 /Lib/distutils/util.py
parentda4d1aef4e8f9589956ea7a1e8cf2bbb249cb0eb (diff)
downloadcpython-739d06689dfd37e9233599c3fd95852bb96f71a1.zip
cpython-739d06689dfd37e9233599c3fd95852bb96f71a1.tar.gz
cpython-739d06689dfd37e9233599c3fd95852bb96f71a1.tar.bz2
Documented Bastian's patch.
Made handling OSError in 'mkpath()' more standard.
Diffstat (limited to 'Lib/distutils/util.py')
-rw-r--r--Lib/distutils/util.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py
index 6351bc7..8242e10 100644
--- a/Lib/distutils/util.py
+++ b/Lib/distutils/util.py
@@ -24,11 +24,13 @@ PATH_CREATED = {}
# succeed in that case).
def mkpath (name, mode=0777, verbose=0, dry_run=0):
"""Create a directory and any missing ancestor directories. If the
- directory already exists, return silently. Raise
- DistutilsFileError if unable to create some directory along the
- way (eg. some sub-path exists, but is a file rather than a
- directory). If 'verbose' is true, print a one-line summary of
- each mkdir to stdout."""
+ directory already exists (or if 'name' is the empty string, which
+ means the current directory, which of course exists), then do
+ nothing. Raise DistutilsFileError if unable to create some
+ directory along the way (eg. some sub-path exists, but is a file
+ rather than a directory). If 'verbose' is true, print a one-line
+ summary of each mkdir to stdout. Return the list of directories
+ actually created."""
global PATH_CREATED
@@ -71,9 +73,9 @@ def mkpath (name, mode=0777, verbose=0, dry_run=0):
try:
os.mkdir (head)
created_dirs.append(head)
- except os.error, (errno, errstr):
+ except OSError, exc:
raise DistutilsFileError, \
- "could not create '%s': %s" % (head, errstr)
+ "could not create '%s': %s" % (head, exc[-1])
PATH_CREATED[head] = 1
return created_dirs