| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 # vim: set ts=2 sw=2 et sts=2 ai: | 5 # vim: set ts=2 sw=2 et sts=2 ai: |
| 6 | 6 |
| 7 """Minimal tool to download binutils from Google storage. | 7 """Minimal tool to download binutils from Google storage. |
| 8 | 8 |
| 9 TODO(mithro): Replace with generic download_and_extract tool. | 9 TODO(mithro): Replace with generic download_and_extract tool. |
| 10 """ | 10 """ |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 def WriteFile(filename, content): | 34 def WriteFile(filename, content): |
| 35 assert not os.path.exists(filename) | 35 assert not os.path.exists(filename) |
| 36 with file(filename, 'w') as f: | 36 with file(filename, 'w') as f: |
| 37 f.write(content) | 37 f.write(content) |
| 38 f.write('\n') | 38 f.write('\n') |
| 39 | 39 |
| 40 | 40 |
| 41 def GetArch(): | 41 def GetArch(): |
| 42 gyp_host_arch = re.search( | 42 gyp_host_arch = re.search( |
| 43 'host_arch=([^ ]*)', os.environ.get('GYP_DEFINES', '')) | 43 'host_arch=(\S*)', os.environ.get('GYP_DEFINES', '')) |
| 44 if gyp_host_arch: | 44 if gyp_host_arch: |
| 45 arch = gyp_host_arch.group(1) | 45 arch = gyp_host_arch.group(1) |
| 46 # This matches detect_host_arch.py. | 46 # This matches detect_host_arch.py. |
| 47 if arch == 'x86_64': | 47 if arch == 'x86_64': |
| 48 return 'x64' | 48 return 'x64' |
| 49 return arch | 49 return arch |
| 50 | 50 |
| 51 return subprocess.check_output(['python', DETECT_HOST_ARCH]).strip() | 51 return subprocess.check_output(['python', DETECT_HOST_ARCH]).strip() |
| 52 | 52 |
| 53 | 53 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 if ret != 0: | 109 if ret != 0: |
| 110 return ret | 110 return ret |
| 111 # Fetch the x64 toolchain as well for official bots with 64-bit kernels. | 111 # Fetch the x64 toolchain as well for official bots with 64-bit kernels. |
| 112 return FetchAndExtract('x64') | 112 return FetchAndExtract('x64') |
| 113 print "Host architecture %s is not supported." % arch | 113 print "Host architecture %s is not supported." % arch |
| 114 return 1 | 114 return 1 |
| 115 | 115 |
| 116 | 116 |
| 117 if __name__ == '__main__': | 117 if __name__ == '__main__': |
| 118 sys.exit(main(sys.argv)) | 118 sys.exit(main(sys.argv)) |
| OLD | NEW |