* copy is much easier and painless.

This commit is contained in:
Faik Uygur
2007-02-05 20:55:22 +00:00
parent f5a5bac9a0
commit a08d3dfc51
+7 -9
View File
@@ -18,6 +18,7 @@ _ = __trans.ugettext
import sys import sys
import os import os
import bsddb3.db as db import bsddb3.db as db
import shutil
import pisi import pisi
import pisi.context as ctx import pisi.context as ctx
@@ -31,6 +32,7 @@ from pisi.files import Files
from pisi.uri import URI from pisi.uri import URI
import pisi.ui import pisi.ui
from pisi.version import Version from pisi.version import Version
from pisi.delta import find_relocations
class Error(pisi.Error): class Error(pisi.Error):
pass pass
@@ -291,17 +293,13 @@ class Install(AtomicOperation):
# of these files may be relocated to some other directory in the new package. # of these files may be relocated to some other directory in the new package.
# We handle these cases here. # We handle these cases here.
def relocate_files(): def relocate_files():
from shutil import move
from pisi.delta import find_relocations
relocations = find_relocations(self.old_files, self.files)
for old_file, new_file in relocations: for old_file, new_file in find_relocations(self.old_files, self.files):
path = "/%s" % os.path.dirname(new_file.path) destdir = "/" + os.path.dirname(new_file.path)
if not os.path.exists(path): if not os.path.exists(destdir):
os.makedirs(path) os.makedirs(destdir)
move("/%s" % old_file.path, "/%s" % new_file.path) shutil.copy("/" + old_file.path, "/" + new_file.path)
# remove left over files from the old package. # remove left over files from the old package.
def clean_leftovers(): def clean_leftovers():