| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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()) |
| OLD | NEW |