diff options
Diffstat (limited to 'Tools/Scripts/webkitpy/common/system/autoinstall.py')
| -rwxr-xr-x | Tools/Scripts/webkitpy/common/system/autoinstall.py | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/Tools/Scripts/webkitpy/common/system/autoinstall.py b/Tools/Scripts/webkitpy/common/system/autoinstall.py index 4ffcccc64..a928db63a 100755 --- a/Tools/Scripts/webkitpy/common/system/autoinstall.py +++ b/Tools/Scripts/webkitpy/common/system/autoinstall.py @@ -31,8 +31,6 @@ """Support for automatically downloading Python packages from an URL.""" -from __future__ import with_statement - import codecs import logging import new @@ -261,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". @@ -315,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() |
