Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Unified Diff: tools/testrunner/local/utils.py

Issue 1219013007: [test] Fix redirect problem for downloading test data on windows. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Print Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testrunner/local/utils.py
diff --git a/tools/testrunner/local/utils.py b/tools/testrunner/local/utils.py
index 13bd28012e7fb5cb8865d43871c4ed69cefbcf66..2842b13913e638190f7fd267fb7d9c851097fef0 100644
--- a/tools/testrunner/local/utils.py
+++ b/tools/testrunner/local/utils.py
@@ -32,6 +32,7 @@ from os.path import isdir
from os.path import join
import platform
import re
+import subprocess
import urllib2
@@ -121,5 +122,15 @@ def IsWindows():
def URLRetrieve(source, destination):
"""urllib is broken for SSL connections via a proxy therefore we
can't use urllib.urlretrieve()."""
+ if IsWindows():
+ try:
+ # In python 2.7.6 on windows, urlopen has a problem with redirects.
+ # Try using curl instead. Note, this is fixed in 2.7.8.
+ subprocess.check_call(["curl", source, '-L', '-o', destination])
+ return
+ except:
+ # If there's no curl, fall back to urlopen.
+ print "Curl is currently not installed. Falling back to python."
+ pass
with open(destination, 'w') as f:
f.write(urllib2.urlopen(source).read())
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698