From 50b497ea4c4f57bec538da0652543c580a36c72c Mon Sep 17 00:00:00 2001 From: "A. Murat Eren" Date: Fri, 24 Jun 2005 09:35:01 +0000 Subject: [PATCH] =?UTF-8?q?=20Bir=20tak=C4=B1m=20fiksler..?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Açıklama satırları ekleyeceğim koda yemekten sonra. --- pisi/archive.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pisi/archive.py b/pisi/archive.py index 9585b7f4..47f5a3a0 100644 --- a/pisi/archive.py +++ b/pisi/archive.py @@ -65,6 +65,9 @@ class ArchiveZip(ArchiveBase): Being a zip archive PISI packages also use this class extensively. This class provides unpacking and packing magic for zip archives.""" + + symmagic = 2716663808 #long of hex val '0xA1ED0000L' + def __init__(self, filepath, type="zip", mode='r'): super(ArchiveZip, self).__init__(filepath, type) self.zip = zipfile.ZipFile(filepath, mode) @@ -85,7 +88,7 @@ class ArchiveZip(ArchiveBase): attr = zipfile.ZipInfo() attr.filename = fileName attr.create_system = 3 - attr.external_attr = 2716663808L # long of hex val '0xA1ED0000L' + attr.external_attr = self.symmagic self.zip.writestr(attr, dest) else: self.zip.write(fileName, fileName, zipfile.ZIP_DEFLATED) @@ -114,13 +117,9 @@ class ArchiveZip(ArchiveBase): # check that output dir is present util.check_dir(os.path.dirname(ofile)) - # O.K. we know following line is dull. What we wanted to - # do was to compare the equality to 0xa0000000. But there - # is a known problem in Python regarding the hex/oct - # constants. Please see Guido's explanation at - # http://mail.python.org/pipermail/python-dev/2003-February/033029.html info = zip.getinfo(fileName) - if hex(info.external_attr)[2] == 'A': + + if info.external_attr == self.symmagic: target = zip.read(fileName) os.symlink(target, ofile) else: