Commit e7330a64 authored by machenbach's avatar machenbach Committed by Commit bot

[test] Fix redirect problem for downloading test data on windows.

BUG=v8:4254
LOG=n
NOTRY=true
NOPRESUBMIT=true
NOTREECHECKS=true
TBR=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/1219013007

Cr-Commit-Position: refs/heads/master@{#29510}
parent a104e7c9
......@@ -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())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment