support for building with scons & python 2.4x

This commit is contained in:
Campbell Barton 2010-06-03 23:37:51 +00:00
parent 0729a58224
commit ab5367e09f
1 changed files with 5 additions and 1 deletions

View File

@ -356,7 +356,11 @@ class CompZipFile(zipfile.ZipFile):
"""Partial copy of python2.6's zipfile.ZipFile (see http://www.python.org)
to get a extractall() that works on py2.5 and probably earlier distributions."""
def __init__(self, file, mode="r", compression=zipfile.ZIP_STORED, allowZip64=False):
zipfile.ZipFile.__init__(self, file, mode, compression, allowZip64)
if sys.version_info < (2, 6):
zipfile.ZipFile.__init__(self, file, mode, compression)
else:
zipfile.ZipFile.__init__(self, file, mode, compression, allowZip64)
if not hasattr(self,"extractall"): # use our method
print "Debug: Using comp_extractall!"
self.extractall= self.comp_extractall