Title: [244513] trunk/Tools
Revision
244513
Author
[email protected]
Date
2019-04-22 15:07:47 -0700 (Mon, 22 Apr 2019)

Log Message

Use curl to download packages for webkitpy autoinstaller
https://bugs.webkit.org/show_bug.cgi?id=197164

Reviewed by Darin Adler.

* Scripts/webkitpy/common/system/autoinstall.py:
(AutoInstaller._download): Use curl(1) to download packages necessary for
webkitpy/thirdparty/autoinstalled since Python2's urllib2 module can result in unnecessary
errors which are not present when using curl(1).

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (244512 => 244513)


--- trunk/Tools/ChangeLog	2019-04-22 21:54:58 UTC (rev 244512)
+++ trunk/Tools/ChangeLog	2019-04-22 22:07:47 UTC (rev 244513)
@@ -1,3 +1,15 @@
+2019-04-22  Dean Johnson  <[email protected]>
+
+        Use curl to download packages for webkitpy autoinstaller
+        https://bugs.webkit.org/show_bug.cgi?id=197164
+
+        Reviewed by Darin Adler.
+
+        * Scripts/webkitpy/common/system/autoinstall.py:
+        (AutoInstaller._download): Use curl(1) to download packages necessary for
+        webkitpy/thirdparty/autoinstalled since Python2's urllib2 module can result in unnecessary
+        errors which are not present when using curl(1).
+
 2019-04-22  Chris Dumez  <[email protected]>
 
         Unreviewed, rolling out r244502.

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


--- trunk/Tools/Scripts/webkitpy/common/system/autoinstall.py	2019-04-22 21:54:58 UTC (rev 244512)
+++ trunk/Tools/Scripts/webkitpy/common/system/autoinstall.py	2019-04-22 22:07:47 UTC (rev 244513)
@@ -46,6 +46,7 @@
 from distutils import dir_util
 from glob import glob
 import urlparse
+import subprocess
 
 
 _log = logging.getLogger(__name__)
@@ -418,9 +419,19 @@
             return cache
 
         target_path = os.path.join(scratch_dir, target_filename)
-        with open(target_path, "wb") as stream:
-            self._download_to_stream(url, stream)
 
+        if os.name == 'posix':
+            try:
+                command = ['curl', url, '-L', '--output', target_path]
+                with open(os.devnull, 'w') as devnull:
+                    subprocess.check_call(command, stdout=devnull, stderr=devnull)
+            except subprocess.CalledProcessError as e:
+                _log.info('Error: Failed to download {} to {}. Command: {}'.format(url, target_path, command))
+                raise
+        else:  # Windows
+            with open(target_path, "wb") as stream:
+                self._download_to_stream(url, stream)
+
         if _CACHE_ENV_VAR in os.environ:
             dir_util.copy_tree(scratch_dir, os.environ[_CACHE_ENV_VAR])
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to