Title: [107147] trunk/Tools
Revision
107147
Author
aba...@webkit.org
Date
2012-02-08 16:10:04 -0800 (Wed, 08 Feb 2012)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (107146 => 107147)


--- trunk/Tools/ChangeLog	2012-02-09 00:04:09 UTC (rev 107146)
+++ trunk/Tools/ChangeLog	2012-02-09 00:10:04 UTC (rev 107147)
@@ -1,5 +1,18 @@
 2012-02-08  Adam Barth  <aba...@webkit.org>
 
+        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  <aba...@webkit.org>
+
         Remove the ospath compat shim from webkitpy
         https://bugs.webkit.org/show_bug.cgi?id=78170
 

Modified: trunk/Tools/Scripts/webkitpy/common/system/autoinstall.py (107146 => 107147)


--- trunk/Tools/Scripts/webkitpy/common/system/autoinstall.py	2012-02-09 00:04:09 UTC (rev 107146)
+++ trunk/Tools/Scripts/webkitpy/common/system/autoinstall.py	2012-02-09 00:10:04 UTC (rev 107147)
@@ -259,43 +259,6 @@
 
         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 @@
             raise Exception(message)
 
         try:
-            self._extract_all(zip_file, scratch_dir)
+            zip_file.extractall(scratch_dir)
         finally:
             zip_file.close()
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to