Changeset 107147 in webkit
- Timestamp:
- Feb 8, 2012 4:10:04 PM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r107145 r107147 1 2012-02-08 Adam Barth <abarth@webkit.org> 2 3 Don't re-implement ZipFile.extractall 4 https://bugs.webkit.org/show_bug.cgi?id=78173 5 6 Reviewed by Eric Seidel. 7 8 We can use ZipFile.extractall now that we don't support Python 2.5. 9 10 * Scripts/webkitpy/common/system/autoinstall.py: 11 (AutoInstaller._extract_targz): 12 (AutoInstaller._unzip): 13 1 14 2012-02-08 Adam Barth <abarth@webkit.org> 2 15 -
trunk/Tools/Scripts/webkitpy/common/system/autoinstall.py
r107136 r107147 260 260 return target_path 261 261 262 # This is a replacement for ZipFile.extractall(), which is263 # available in Python 2.6 but not in earlier versions.264 def _extract_all(self, zip_file, target_dir):265 self._log_transfer("Extracting zip file...", zip_file, target_dir)266 267 # This is helpful for debugging purposes.268 _log.debug("Listing zip file contents...")269 for name in zip_file.namelist():270 _log.debug(' * "%s"' % name)271 272 for name in zip_file.namelist():273 path = os.path.join(target_dir, name)274 self._log_transfer("Extracting...", name, path)275 276 if not os.path.basename(path):277 # Then the path ends in a slash, so it is a directory.278 self._create_directory(path)279 continue280 # Otherwise, it is a file.281 282 try:283 # We open this file w/o encoding, as we're reading/writing284 # the raw byte-stream from the zip file.285 outfile = open(path, 'wb')286 except IOError, err:287 # Not all zip files seem to list the directories explicitly,288 # so try again after creating the containing directory.289 _log.debug("Got IOError: retrying after creating directory...")290 dir = os.path.dirname(path)291 self._create_directory(dir)292 outfile = open(path, 'wb')293 294 try:295 outfile.write(zip_file.read(name))296 finally:297 outfile.close()298 299 262 def _unzip(self, path, scratch_dir): 300 263 # zipfile.extractall() extracts to a path without the … … 314 277 315 278 try: 316 self._extract_all(zip_file,scratch_dir)279 zip_file.extractall(scratch_dir) 317 280 finally: 318 281 zip_file.close()
Note: See TracChangeset
for help on using the changeset viewer.