new_path should be deleted. If it is a regular file copy works on it, but if it is

a symlink as seen on virtualbox delta package, it becomes a problem.
This commit is contained in:
Faik Uygur
2009-01-20 07:42:47 +00:00
parent acb11ab50c
commit 9a17fe0ec0
+3 -1
View File
@@ -337,8 +337,10 @@ class Install(AtomicOperation):
if not os.path.exists(destdir): if not os.path.exists(destdir):
os.makedirs(destdir) os.makedirs(destdir)
if os.path.lexists(new_path):
os.unlink(new_path)
if os.path.islink(old_path): if os.path.islink(old_path):
if not os.path.lexists(new_path):
os.symlink(os.readlink(old_path), new_path) os.symlink(os.readlink(old_path), new_path)
else: else:
shutil.copy(old_path, new_path) shutil.copy(old_path, new_path)