Merge "Use exec(curl) for downloading artifacts"
diff --git a/tools/heap_profile b/tools/heap_profile
index f2aaf0f..a969de4 100755
--- a/tools/heap_profile
+++ b/tools/heap_profile
@@ -30,12 +30,6 @@
 import time
 import uuid
 
-try:
-    # Python 2.x
-    from urllib import urlretrieve
-except ImportError:
-    # Python 3.x
-    from urllib.request import urlretrieve
 
 TRACE_TO_TEXT_SHAS = {
     'linux': 'aba0e660818bfc249992ebbceb13a2e4c9a62c3a',
@@ -71,7 +65,7 @@
       return local_file
 
   url = TRACE_TO_TEXT_BASE_URL + file_name
-  urlretrieve(url, local_file)
+  subprocess.check_call(['curl', '-#', '-o', local_file, url])
   if not check_hash(local_file, sha_value):
     os.remove(local_file)
     raise ValueError("Invalid signature.")
diff --git a/tools/install-build-deps b/tools/install-build-deps
index b189463..7bd693c 100755
--- a/tools/install-build-deps
+++ b/tools/install-build-deps
@@ -26,7 +26,6 @@
 from collections import namedtuple
 from platform import system
 
-from compat import urlretrieve
 
 # The format for the deps below is the following:
 # (target_folder, source_url, sha1, target_platform)
@@ -232,6 +231,10 @@
 NODE_MODULES_STATUS_FILE = os.path.join(UI_DIR, 'node_modules', '.last_install')
 
 
+def DownloadURL(url, out_file):
+  subprocess.check_call(['curl', '-#', '-o', out_file, url])
+
+
 def ReadFile(path):
   if not os.path.exists(path):
     return None
@@ -315,7 +318,7 @@
       logging.info('Downloading %s from %s', rel_path, url)
       with tempfile.NamedTemporaryFile(delete=False) as f:
         f.close()
-        urlretrieve(url, f.name)
+        DownloadURL(url, f.name)
         actual_sha1 = HashLocalFile(f.name)
         os.unlink(f.name)
         if (actual_sha1 != expected_sha1):
@@ -361,7 +364,7 @@
     if HashLocalFile(local_path) != expected_sha1:
       download_path = local_path + '.tmp'
       logging.info('Downloading %s from %s', local_path, url)
-      urlretrieve(url, download_path)
+      DownloadURL(url, download_path)
       os.chmod(download_path, 0o755)
       actual_sha1 = HashLocalFile(download_path)
       if (actual_sha1 != expected_sha1):