From 4fe977947e0a9790314effcf3e3bf35384747f85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Metin?= Date: Tue, 28 Jun 2005 09:39:00 +0000 Subject: [PATCH] =?UTF-8?q?-=20hatal=C4=B1=20super=20de=C4=9Fi=C5=9Ftirild?= =?UTF-8?q?i.=20-=20Archive'in=20kullan=C4=B1c=C4=B1s=C4=B1=20iste=C4=9Fe?= =?UTF-8?q?=20ba=C4=9Fl=C4=B1=20olarak=20cleanDir=20tan=C4=B1mlayabilmeli.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pisi/archive.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pisi/archive.py b/pisi/archive.py index be33c946..4269e1bf 100644 --- a/pisi/archive.py +++ b/pisi/archive.py @@ -38,9 +38,9 @@ class ArchiveTar(ArchiveBase): def __init__(self, filepath, type="tar"): super(ArchiveTar, self).__init__(filepath, type) - def unpack(self, targetDir): + def unpack(self, targetDir, cleanDir=False): """Unpack tar archive to a given target directory(targetDir).""" - super(ArchiveTar, self).unpack(targetDir) + super(ArchiveTar, self).unpack(targetDir, cleanDir) rmode = "" if self.type == 'tar': @@ -113,7 +113,6 @@ class ArchiveZip(ArchiveBase): def unpack_file_cond(self, pred, targetDir, archiveRoot=''): """Unpack/Extract a file according to predicate function filename -> bool""" - super(ArchiveZip, self).unpack(targetDir, False) zip = self.zip for info in zip.infolist(): if pred(info.filename): # check if condition holds @@ -163,7 +162,9 @@ class ArchiveZip(ArchiveBase): def unpack_dir_flat(self, path, targetDir): self.unpack_file_cond(lambda f:util.subpath(path,f), targetDir, path) - def unpack(self, targetDir): + def unpack(self, targetDir, cleanDir=False): + super(ArchiveZip, self).unpack(targetDir, cleanDir) + self.unpack_file_cond(lambda f: True, targetDir) self.close() return @@ -185,8 +186,8 @@ class Archive: self.archive = handlers.get(type)(filepath, type) - def unpack(self, targetDir): - self.archive.unpack(targetDir) + def unpack(self, targetDir, cleanDir=False): + self.archive.unpack(targetDir, cleanDir) def unpack_files(self, files, targetDir): self.archive.unpack_files(files, targetDir)