| 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 24 matching lines...) Expand all Loading... |
| 35 # gclient sync time for developers, or standard Chrome bots. | 35 # gclient sync time for developers, or standard Chrome bots. |
| 36 if '--optional-pnacl' in args: | 36 if '--optional-pnacl' in args: |
| 37 args.remove('--optional-pnacl') | 37 args.remove('--optional-pnacl') |
| 38 use_pnacl = False | 38 use_pnacl = False |
| 39 buildbot_name = os.environ.get('BUILDBOT_BUILDERNAME', '') | 39 buildbot_name = os.environ.get('BUILDBOT_BUILDERNAME', '') |
| 40 if 'pnacl' in buildbot_name and 'sdk' in buildbot_name: | 40 if 'pnacl' in buildbot_name and 'sdk' in buildbot_name: |
| 41 use_pnacl = True | 41 use_pnacl = True |
| 42 if use_pnacl: | 42 if use_pnacl: |
| 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 = ['--exclude', 'pnacl_newlib'] + args |
| 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 = ['--exclude', 'nacl_arm_newlib'] + args |
| 52 | 52 |
| 53 args.extend(['--mode', 'nacl_core_sdk']) | |
| 54 args.append('sync') | |
| 55 package_version.main(args) | 53 package_version.main(args) |
| 56 | 54 |
| 57 # Because we are no longer extracting the toolchain, it is best to delete | |
| 58 # the old extracted ones so that no stale toolchains are left behind. This | |
| 59 # also would catch any stale code that happens to work because it is using | |
| 60 # an old extracted toolchain that was left behind. | |
| 61 toolchain_dir = os.path.join(nacl_dir, 'toolchain') | |
| 62 for toolchain_item in os.listdir(toolchain_dir): | |
| 63 toolchain_path = os.path.join(toolchain_dir, toolchain_item) | |
| 64 if os.path.isdir(toolchain_path) and not toolchain_item.startswith('.'): | |
| 65 shutil.rmtree(toolchain_path) | |
| 66 | |
| 67 return 0 | 55 return 0 |
| 68 | 56 |
| 69 | 57 |
| 70 if __name__ == '__main__': | 58 if __name__ == '__main__': |
| 71 sys.exit(Main(sys.argv[1:])) | 59 sys.exit(Main(sys.argv[1:])) |
| OLD | NEW |