FileEntry super class needed returnedBytes field for DeflatedZipEntry class.
skipped ZIP_7ZIP -> ZIP_LZMA change.
This commit is contained in:
+1
-1
@@ -130,7 +130,7 @@ class ArchiveZip(ArchiveBase):
|
|||||||
attr.external_attr = self.symmagic
|
attr.external_attr = self.symmagic
|
||||||
self.zip_obj.writestr(attr, dest)
|
self.zip_obj.writestr(attr, dest)
|
||||||
else:
|
else:
|
||||||
self.zip_obj.write(file_name, file_name, zipfileext.ZIP_7ZIP)
|
self.zip_obj.write(file_name, file_name, zipfileext.ZIP_LZMA)
|
||||||
zinfo = self.zip_obj.getinfo(file_name)
|
zinfo = self.zip_obj.getinfo(file_name)
|
||||||
zinfo.create_system = 3
|
zinfo.create_system = 3
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -12,7 +12,7 @@
|
|||||||
# Authors: Eray Ozkural <eray@pardus.org.tr>
|
# Authors: Eray Ozkural <eray@pardus.org.tr>
|
||||||
# Faik Uygur <faik@pardus.org.tr>
|
# Faik Uygur <faik@pardus.org.tr>
|
||||||
#
|
#
|
||||||
# Extends zipfile module with LZMA and bzip2 support
|
# Extends zipfile module with lzma and bzip2 support
|
||||||
|
|
||||||
# python standard library modules
|
# python standard library modules
|
||||||
import os
|
import os
|
||||||
@@ -48,10 +48,11 @@ class FileEntry:
|
|||||||
def __init__(self, fp, length):
|
def __init__(self, fp, length):
|
||||||
self.fp = fp
|
self.fp = fp
|
||||||
self.readBytes = 0
|
self.readBytes = 0
|
||||||
|
self.returnedBytes = 0
|
||||||
self.length = length
|
self.length = length
|
||||||
self.finished = 0
|
self.finished = 0
|
||||||
|
|
||||||
class LZMAFileEntry(FileEntry):
|
class LzmaFileEntry(FileEntry):
|
||||||
"""File-like object used to read a LZMA entry in a ZipFile"""
|
"""File-like object used to read a LZMA entry in a ZipFile"""
|
||||||
|
|
||||||
def __init__(self, fp, length):
|
def __init__(self, fp, length):
|
||||||
@@ -291,7 +292,7 @@ class ZipFileExt(ZipFile):
|
|||||||
if not pylzma:
|
if not pylzma:
|
||||||
raise RuntimeError, \
|
raise RuntimeError, \
|
||||||
"De-compression requires the (missing) pylzma module"
|
"De-compression requires the (missing) pylzma module"
|
||||||
return LZMAFileEntry(self.fp, zinfo.compress_size)
|
return LzmaFileEntry(self.fp, zinfo.compress_size)
|
||||||
else:
|
else:
|
||||||
raise BadZipfile, \
|
raise BadZipfile, \
|
||||||
"Unsupported compression method %d for file %s" % \
|
"Unsupported compression method %d for file %s" % \
|
||||||
|
|||||||
Reference in New Issue
Block a user