Fix a bug in SmartCopy when printing an error message

This commit is contained in:
Martin Gracik 2010-02-25 19:36:20 +01:00
parent 18ad481067
commit ad726c68ec

View File

@ -325,20 +325,22 @@ class SmartCopy(object):
os.unlink(dst) os.unlink(dst)
# copy all the files # copy all the files
try: for src, dst in self.copyfiles:
map(lambda (src, dst): shutil.copy2(src, dst), self.copyfiles) try:
except shutil.Error as why: shutil.copy2(src, dst)
err_msg = "error copying file {0} -> {1}: {2}" except shutil.Error as why:
err_msg = err_msg.format(src, dst, why) err_msg = "error copying file {0} -> {1}: {2}"
raise SmartCopyError(err_msg) err_msg = err_msg.format(src, dst, why)
raise SmartCopyError(err_msg)
# create symlinks # create symlinks
try: for target, name in self.links:
map(lambda (target, name): symlink_(target, name), self.links) try:
except OSError as why: symlink_(target, name)
err_msg = "error creating symlink {0} -> {1}: {2}" except OSError as why:
err_msg = err_msg.format(name, target, why) err_msg = "error creating symlink {0} -> {1}: {2}"
raise SmartCopyError(err_msg) err_msg = err_msg.format(name, target, why)
raise SmartCopyError(err_msg)
# XXX # XXX