| 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 """ |
| 11 | 11 |
| 12 import os | 12 import os |
| 13 import platform | 13 import platform |
| 14 import re | 14 import re |
| 15 import shutil | 15 import shutil |
| 16 import subprocess | 16 import subprocess |
| 17 import sys | 17 import sys |
| 18 | 18 |
| 19 | 19 |
| 20 BINUTILS_DIR = os.path.abspath(os.path.dirname(__file__)) | 20 BINUTILS_DIR = os.path.abspath(os.path.dirname(__file__)) |
| 21 BINUTILS_FILE = 'binutils.tar.bz2' | 21 BINUTILS_FILE = 'binutils.tar.bz2' |
| 22 BINUTILS_TOOLS = ['bin/ld.gold', 'bin/objcopy', 'bin/objdump'] | 22 BINUTILS_TOOLS = ['bin/ld.gold', 'bin/objcopy', 'bin/objdump'] |
| 23 BINUTILS_OUT = 'Release' | 23 BINUTILS_OUT = 'Release' |
| 24 | 24 |
| 25 DETECT_HOST_ARCH = os.path.abspath(os.path.join( | 25 DETECT_HOST_ARCH = os.path.abspath(os.path.join( |
| 26 BINUTILS_DIR, '../../build/linux/detect_host_arch.py')) | 26 BINUTILS_DIR, '../../build/detect_host_arch.py')) |
| 27 | 27 |
| 28 | 28 |
| 29 def ReadFile(filename): | 29 def ReadFile(filename): |
| 30 with file(filename, 'r') as f: | 30 with file(filename, 'r') as f: |
| 31 return f.read().strip() | 31 return f.read().strip() |
| 32 | 32 |
| 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: |
| (...skipping 72 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 |