name = os.path.normpath (name)
- if os.path.isdir (name):
+ if os.path.isdir (name) or name == '':
return
if PATH_CREATED.get (name):
return
try:
os.mkdir (head)
except os.error, (errno, errstr):
- raise DistutilsFileError, "%s: %s" % (head, errstr)
+ raise DistutilsFileError, "'%s': %s" % (head, errstr)
PATH_CREATED[head] = 1
try:
fsrc = open(src, 'rb')
except os.error, (errno, errstr):
- raise DistutilsFileError, "could not open %s: %s" % (src, errstr)
+ raise DistutilsFileError, \
+ "could not open '%s': %s" % (src, errstr)
try:
fdst = open(dst, 'wb')
except os.error, (errno, errstr):
- raise DistutilsFileError, "could not create %s: %s" % (dst, errstr)
+ raise DistutilsFileError, \
+ "could not create '%s': %s" % (dst, errstr)
while 1:
try:
buf = fsrc.read (buffer_size)
except os.error, (errno, errstr):
raise DistutilsFileError, \
- "could not read from %s: %s" % (src, errstr)
+ "could not read from '%s': %s" % (src, errstr)
if not buf:
break
fdst.write(buf)
except os.error, (errno, errstr):
raise DistutilsFileError, \
- "could not write to %s: %s" % (dst, errstr)
+ "could not write to '%s': %s" % (dst, errstr)
finally:
if fdst:
if not os.path.isfile (src):
raise DistutilsFileError, \
- "can't copy %s: not a regular file" % src
+ "can't copy '%s': not a regular file" % src
if os.path.isdir (dst):
dir = dst
if not dry_run and not os.path.isdir (src):
raise DistutilsFileError, \
- "cannot copy tree %s: not a directory" % src
+ "cannot copy tree '%s': not a directory" % src
try:
names = os.listdir (src)
except os.error, (errno, errstr):
names = []
else:
raise DistutilsFileError, \
- "error listing files in %s: %s" % (src, errstr)
+ "error listing files in '%s': %s" % (src, errstr)
if not dry_run:
mkpath (dst, verbose=verbose)