fixed: ZipFile.extractall is buggy in python 2.6.1

This commit is contained in:
Nick Bolton 2014-03-19 14:21:12 +00:00
parent 4825f13868
commit 8283955765
1 changed files with 18 additions and 6 deletions

View File

@ -328,10 +328,10 @@ class InternalCommands:
raise Exception('Crypto++ zip not found at: ' + zipFilename)
if not os.path.exists(dir):
os.mkdir(dir)
os.mkdir(dir)
zip = zipfile.ZipFile(zipFilename)
zip.extractall(dir)
self.zipExtractAll(zip, dir)
def checkGTest(self):
@ -344,10 +344,10 @@ class InternalCommands:
raise Exception('GTest zip not found at: ' + zipFilename)
if not os.path.exists(dir):
os.mkdir(dir)
os.mkdir(dir)
zip = zipfile.ZipFile(zipFilename)
zip.extractall(dir)
self.zipExtractAll(zip, dir)
def checkGMock(self):
@ -360,10 +360,22 @@ class InternalCommands:
raise Exception('GMock zip not found at: ' + zipFilename)
if not os.path.exists(dir):
os.mkdir(dir)
os.mkdir(dir)
zip = zipfile.ZipFile(zipFilename)
zip.extractall(dir)
self.zipExtractAll(zip, dir)
# ZipFile.extractall() is buggy in 2.6.1
# http://bugs.python.org/issue4710
def zipExtractAll(self, z, dir):
if not dir.endswith("/"):
dir += "/"
for f in z.namelist():
if f.endswith("/"):
os.makedirs(dir + f)
else:
z.extract(f, dir)
def configure(self, target='', extraArgs=''):