diff options
| author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-09 14:16:12 +0100 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-09 14:16:12 +0100 |
| commit | 03e12282df9aa1e1fb05a8b90f1cfc2e08764cec (patch) | |
| tree | 52599cd0ab782b1768e23ad176f7618f98333cb6 /Tools/Scripts/webkitpy/common/system/autoinstall.py | |
| parent | cd44dc59cdfc39534aef4d417e9f3c412e3be139 (diff) | |
| download | qtwebkit-03e12282df9aa1e1fb05a8b90f1cfc2e08764cec.tar.gz | |
Imported WebKit commit e09a82039aa4273ab318b71122e92d8e5f233525 (http://svn.webkit.org/repository/webkit/trunk@107223)
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() |
