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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2012 the V8 project authors. All rights reserved. 1 # Copyright 2012 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
4 # met: 4 # met:
5 # 5 #
6 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
(...skipping 14 matching lines...) Expand all
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 28
29 import os 29 import os
30 from os.path import exists 30 from os.path import exists
31 from os.path import isdir 31 from os.path import isdir
32 from os.path import join 32 from os.path import join
33 import platform 33 import platform
34 import re 34 import re
35 import subprocess
35 import urllib2 36 import urllib2
36 37
37 38
38 def GetSuitePaths(test_root): 39 def GetSuitePaths(test_root):
39 return [ f for f in os.listdir(test_root) if isdir(join(test_root, f)) ] 40 return [ f for f in os.listdir(test_root) if isdir(join(test_root, f)) ]
40 41
41 42
42 # Reads a file into an array of strings 43 # Reads a file into an array of strings
43 def ReadLinesFrom(name): 44 def ReadLinesFrom(name):
44 lines = [] 45 lines = []
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 return '32' 115 return '32'
115 116
116 117
117 def IsWindows(): 118 def IsWindows():
118 return GuessOS() == 'windows' 119 return GuessOS() == 'windows'
119 120
120 121
121 def URLRetrieve(source, destination): 122 def URLRetrieve(source, destination):
122 """urllib is broken for SSL connections via a proxy therefore we 123 """urllib is broken for SSL connections via a proxy therefore we
123 can't use urllib.urlretrieve().""" 124 can't use urllib.urlretrieve()."""
125 if IsWindows():
126 try:
127 # In python 2.7.6 on windows, urlopen has a problem with redirects.
128 # Try using curl instead. Note, this is fixed in 2.7.8.
129 subprocess.check_call(["curl", source, '-L', '-o', destination])
130 return
131 except:
132 # If there's no curl, fall back to urlopen.
133 print "Curl is currently not installed. Falling back to python."
134 pass
124 with open(destination, 'w') as f: 135 with open(destination, 'w') as f:
125 f.write(urllib2.urlopen(source).read()) 136 f.write(urllib2.urlopen(source).read())
OLDNEW
« 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