From 089e803aff96667cf0f8584d12db3acacd32e759 Mon Sep 17 00:00:00 2001 From: "A. Murat Eren" Date: Wed, 15 Jun 2005 14:34:28 +0000 Subject: [PATCH] =?UTF-8?q?art=C4=B1k=20symlinkleri=20d=C3=BCzg=C3=BCn=20o?= =?UTF-8?q?lu=C5=9Fturuyoruz..=20onur=20k=C3=BC=C3=A7=C3=BCk=20beylere=20t?= =?UTF-8?q?e=C5=9Fekk=C3=BCr=20ederik.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pisi/archive.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/pisi/archive.py b/src/pisi/archive.py index 7bc8ed30..6cd715ad 100644 --- a/src/pisi/archive.py +++ b/src/pisi/archive.py @@ -56,8 +56,7 @@ class ArchiveZip(ArchiveBase): super(ArchiveZip, self).unpack(targetDir) zip = zipfile.ZipFile(self.filePath, 'r') - fileNames = zip.namelist() - for file in fileNames: + for file in zip.namelist(): ofile = self.targetDir + '/' + file # a directory is present. lets continue @@ -67,11 +66,15 @@ class ArchiveZip(ArchiveBase): if not os.path.exists(os.path.dirname(ofile)): os.mkdir(ofile) continue - - buff = open (ofile, 'wb') - fileContent = zip.read(file) - buff.write(fileContent) - buff.close() + info = zip.getinfo(file) + if hex(info.external_attr)[2] == 'A': + target = zip.read(file) + os.symlink(target, ofile) + else: + buff = open (ofile, 'wb') + fileContent = zip.read(file) + buff.write(fileContent) + buff.close() zip.close()