| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 | 5 |
| 6 """Shim to run nacl toolchain download script only if there is a nacl dir.""" | 6 """Shim to run nacl toolchain download script only if there is a nacl dir.""" |
| 7 | 7 |
| 8 import os | 8 import os |
| 9 import shutil | 9 import shutil |
| 10 import sys | 10 import sys |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 print '\n*** DOWNLOADING PNACL TOOLCHAIN ***\n' | 43 print '\n*** DOWNLOADING PNACL TOOLCHAIN ***\n' |
| 44 else: | 44 else: |
| 45 args.extend(['--exclude', 'pnacl_newlib']) | 45 args.extend(['--exclude', 'pnacl_newlib']) |
| 46 | 46 |
| 47 # Only download the ARM gcc toolchain if we are building for ARM | 47 # Only download the ARM gcc toolchain if we are building for ARM |
| 48 # TODO(olonho): we need to invent more reliable way to get build | 48 # TODO(olonho): we need to invent more reliable way to get build |
| 49 # configuration info, to know if we're building for ARM. | 49 # configuration info, to know if we're building for ARM. |
| 50 if 'target_arch=arm' not in os.environ.get('GYP_DEFINES', ''): | 50 if 'target_arch=arm' not in os.environ.get('GYP_DEFINES', ''): |
| 51 args.extend(['--exclude', 'nacl_arm_newlib']) | 51 args.extend(['--exclude', 'nacl_arm_newlib']) |
| 52 | 52 |
| 53 args.extend(['--mode', 'nacl_core_sdk']) |
| 53 args.append('sync') | 54 args.append('sync') |
| 54 package_version.main(args) | 55 package_version.main(args) |
| 55 | 56 |
| 56 # Because we are no longer extracting the toolchain, it is best to delete | 57 # Because we are no longer extracting the toolchain, it is best to delete |
| 57 # the old extracted ones so that no stale toolchains are left behind. This | 58 # the old extracted ones so that no stale toolchains are left behind. This |
| 58 # also would catch any stale code that happens to work because it is using | 59 # also would catch any stale code that happens to work because it is using |
| 59 # an old extracted toolchain that was left behind. | 60 # an old extracted toolchain that was left behind. |
| 60 toolchain_dir = os.path.join(nacl_dir, 'toolchain') | 61 toolchain_dir = os.path.join(nacl_dir, 'toolchain') |
| 61 for toolchain_item in os.listdir(toolchain_dir): | 62 for toolchain_item in os.listdir(toolchain_dir): |
| 62 toolchain_path = os.path.join(toolchain_dir, toolchain_item) | 63 toolchain_path = os.path.join(toolchain_dir, toolchain_item) |
| 63 if os.path.isdir(toolchain_path) and not toolchain_item.startswith('.'): | 64 if os.path.isdir(toolchain_path) and not toolchain_item.startswith('.'): |
| 64 shutil.rmtree(toolchain_path) | 65 shutil.rmtree(toolchain_path) |
| 65 | 66 |
| 66 return 0 | 67 return 0 |
| 67 | 68 |
| 68 | 69 |
| 69 if __name__ == '__main__': | 70 if __name__ == '__main__': |
| 70 sys.exit(Main(sys.argv[1:])) | 71 sys.exit(Main(sys.argv[1:])) |
| OLD | NEW |