From 583fddc456f697c847b31801d1a71f689abf3f4d Mon Sep 17 00:00:00 2001 From: "abarth@webkit.org" Date: Thu, 9 Feb 2012 00:10:04 +0000 Subject: [PATCH] Don't re-implement ZipFile.extractall https://bugs.webkit.org/show_bug.cgi?id=78173 Reviewed by Eric Seidel. We can use ZipFile.extractall now that we don't support Python 2.5. * Scripts/webkitpy/common/system/autoinstall.py: (AutoInstaller._extract_targz): (AutoInstaller._unzip): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107147 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Tools/ChangeLog | 13 ++++++++ .../Scripts/webkitpy/common/system/autoinstall.py | 39 +--------------------- 2 files changed, 14 insertions(+), 38 deletions(-) diff --git a/Tools/ChangeLog b/Tools/ChangeLog index 8a25592..fdb079d 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,5 +1,18 @@ 2012-02-08 Adam Barth + Don't re-implement ZipFile.extractall + https://bugs.webkit.org/show_bug.cgi?id=78173 + + Reviewed by Eric Seidel. + + We can use ZipFile.extractall now that we don't support Python 2.5. + + * Scripts/webkitpy/common/system/autoinstall.py: + (AutoInstaller._extract_targz): + (AutoInstaller._unzip): + +2012-02-08 Adam Barth + Remove the ospath compat shim from webkitpy https://bugs.webkit.org/show_bug.cgi?id=78170 diff --git a/Tools/Scripts/webkitpy/common/system/autoinstall.py b/Tools/Scripts/webkitpy/common/system/autoinstall.py index 8be8545..a928db6 100755 --- a/Tools/Scripts/webkitpy/common/system/autoinstall.py +++ b/Tools/Scripts/webkitpy/common/system/autoinstall.py @@ -259,43 +259,6 @@ class AutoInstaller(object): return target_path - # This is a replacement for ZipFile.extractall(), which is - # available in Python 2.6 but not in earlier versions. - def _extract_all(self, zip_file, target_dir): - self._log_transfer("Extracting zip file...", zip_file, target_dir) - - # This is helpful for debugging purposes. - _log.debug("Listing zip file contents...") - for name in zip_file.namelist(): - _log.debug(' * "%s"' % name) - - for name in zip_file.namelist(): - path = os.path.join(target_dir, name) - self._log_transfer("Extracting...", name, path) - - if not os.path.basename(path): - # Then the path ends in a slash, so it is a directory. - self._create_directory(path) - continue - # Otherwise, it is a file. - - try: - # We open this file w/o encoding, as we're reading/writing - # the raw byte-stream from the zip file. - outfile = open(path, 'wb') - except IOError, err: - # Not all zip files seem to list the directories explicitly, - # so try again after creating the containing directory. - _log.debug("Got IOError: retrying after creating directory...") - dir = os.path.dirname(path) - self._create_directory(dir) - outfile = open(path, 'wb') - - try: - outfile.write(zip_file.read(name)) - finally: - outfile.close() - def _unzip(self, path, scratch_dir): # zipfile.extractall() extracts to a path without the # trailing ".zip". @@ -313,7 +276,7 @@ class AutoInstaller(object): raise Exception(message) try: - self._extract_all(zip_file, scratch_dir) + zip_file.extractall(scratch_dir) finally: zip_file.close() -- 2.7.4