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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 return GuessOS() == 'windows' | 119 return GuessOS() == 'windows' |
120 | 120 |
121 | 121 |
122 def URLRetrieve(source, destination): | 122 def URLRetrieve(source, destination): |
123 """urllib is broken for SSL connections via a proxy therefore we | 123 """urllib is broken for SSL connections via a proxy therefore we |
124 can't use urllib.urlretrieve().""" | 124 can't use urllib.urlretrieve().""" |
125 if IsWindows(): | 125 if IsWindows(): |
126 try: | 126 try: |
127 # In python 2.7.6 on windows, urlopen has a problem with redirects. | 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. | 128 # Try using curl instead. Note, this is fixed in 2.7.8. |
129 subprocess.check_call(["curl", source, '-L', '-o', destination]) | 129 subprocess.check_call(["curl", source, '-k', '-L', '-o', destination]) |
130 return | 130 return |
131 except: | 131 except: |
132 # If there's no curl, fall back to urlopen. | 132 # If there's no curl, fall back to urlopen. |
133 print "Curl is currently not installed. Falling back to python." | 133 print "Curl is currently not installed. Falling back to python." |
134 pass | 134 pass |
135 with open(destination, 'w') as f: | 135 with open(destination, 'w') as f: |
136 f.write(urllib2.urlopen(source).read()) | 136 f.write(urllib2.urlopen(source).read()) |
OLD | NEW |