Bir takım fiksler..

Açıklama satırları ekleyeceğim koda yemekten sonra.
This commit is contained in:
A. Murat Eren
2005-06-24 09:35:01 +00:00
parent 0c8da14c87
commit 50b497ea4c
+6 -7
View File
@@ -65,6 +65,9 @@ class ArchiveZip(ArchiveBase):
Being a zip archive PISI packages also use this class Being a zip archive PISI packages also use this class
extensively. This class provides unpacking and packing magic for extensively. This class provides unpacking and packing magic for
zip archives.""" zip archives."""
symmagic = 2716663808 #long of hex val '0xA1ED0000L'
def __init__(self, filepath, type="zip", mode='r'): def __init__(self, filepath, type="zip", mode='r'):
super(ArchiveZip, self).__init__(filepath, type) super(ArchiveZip, self).__init__(filepath, type)
self.zip = zipfile.ZipFile(filepath, mode) self.zip = zipfile.ZipFile(filepath, mode)
@@ -85,7 +88,7 @@ class ArchiveZip(ArchiveBase):
attr = zipfile.ZipInfo() attr = zipfile.ZipInfo()
attr.filename = fileName attr.filename = fileName
attr.create_system = 3 attr.create_system = 3
attr.external_attr = 2716663808L # long of hex val '0xA1ED0000L' attr.external_attr = self.symmagic
self.zip.writestr(attr, dest) self.zip.writestr(attr, dest)
else: else:
self.zip.write(fileName, fileName, zipfile.ZIP_DEFLATED) self.zip.write(fileName, fileName, zipfile.ZIP_DEFLATED)
@@ -114,13 +117,9 @@ class ArchiveZip(ArchiveBase):
# check that output dir is present # check that output dir is present
util.check_dir(os.path.dirname(ofile)) 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) info = zip.getinfo(fileName)
if hex(info.external_attr)[2] == 'A':
if info.external_attr == self.symmagic:
target = zip.read(fileName) target = zip.read(fileName)
os.symlink(target, ofile) os.symlink(target, ofile)
else: else: