| 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 sys | 9 import sys |
| 10 | 10 |
| 11 | 11 |
| 12 def Main(args): | 12 def Main(args): |
| 13 # Exit early if disable_nacl=1. | 13 # Exit early if disable_nacl=1. |
| 14 if 'disable_nacl=1' in os.environ.get('GYP_DEFINES', ''): | 14 if 'disable_nacl=1' in os.environ.get('GYP_DEFINES', ''): |
| 15 print 'NACL is disabled. Skipping NativeClient toolchain download.' | |
| 16 return 0 | 15 return 0 |
| 17 script_dir = os.path.dirname(os.path.abspath(__file__)) | 16 script_dir = os.path.dirname(os.path.abspath(__file__)) |
| 18 src_dir = os.path.dirname(script_dir) | 17 src_dir = os.path.dirname(script_dir) |
| 19 nacl_dir = os.path.join(src_dir, 'native_client') | 18 nacl_dir = os.path.join(src_dir, 'native_client') |
| 20 nacl_build_dir = os.path.join(nacl_dir, 'build') | 19 nacl_build_dir = os.path.join(nacl_dir, 'build') |
| 21 download_script = os.path.join(nacl_build_dir, 'download_toolchains.py') | 20 download_script = os.path.join(nacl_build_dir, 'download_toolchains.py') |
| 22 if not os.path.exists(download_script): | 21 if not os.path.exists(download_script): |
| 23 print "Can't find '%s'" % download_script | 22 print "Can't find '%s'" % download_script |
| 24 print 'Presumably you are intentionally building without NativeClient.' | 23 print 'Presumably you are intentionally building without NativeClient.' |
| 25 print 'Skipping NativeClient toolchain download.' | 24 print 'Skipping NativeClient toolchain download.' |
| (...skipping 29 matching lines...) Expand all Loading... |
| 55 # a chrome location to avoid branching NaCl if just a toolchain needs | 54 # a chrome location to avoid branching NaCl if just a toolchain needs |
| 56 # to be bumped. | 55 # to be bumped. |
| 57 args.append(os.path.join(nacl_dir, 'TOOL_REVISIONS')) | 56 args.append(os.path.join(nacl_dir, 'TOOL_REVISIONS')) |
| 58 | 57 |
| 59 download_toolchains.main(args) | 58 download_toolchains.main(args) |
| 60 return 0 | 59 return 0 |
| 61 | 60 |
| 62 | 61 |
| 63 if __name__ == '__main__': | 62 if __name__ == '__main__': |
| 64 sys.exit(Main(sys.argv[1:])) | 63 sys.exit(Main(sys.argv[1:])) |
| OLD | NEW |