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 |
11 | 11 |
12 | 12 |
13 def Main(args): | 13 def Main(args): |
14 # Exit early if disable_nacl=1. | |
15 if 'disable_nacl=1' in os.environ.get('GYP_DEFINES', ''): | |
16 return 0 | |
17 script_dir = os.path.dirname(os.path.abspath(__file__)) | 14 script_dir = os.path.dirname(os.path.abspath(__file__)) |
18 src_dir = os.path.dirname(script_dir) | 15 src_dir = os.path.dirname(script_dir) |
19 nacl_dir = os.path.join(src_dir, 'native_client') | 16 nacl_dir = os.path.join(src_dir, 'native_client') |
20 nacl_build_dir = os.path.join(nacl_dir, 'build') | 17 nacl_build_dir = os.path.join(nacl_dir, 'build') |
21 package_version_dir = os.path.join(nacl_build_dir, 'package_version') | 18 package_version_dir = os.path.join(nacl_build_dir, 'package_version') |
22 package_version = os.path.join(package_version_dir, 'package_version.py') | 19 package_version = os.path.join(package_version_dir, 'package_version.py') |
23 if not os.path.exists(package_version): | 20 if not os.path.exists(package_version): |
24 print "Can't find '%s'" % package_version | 21 print "Can't find '%s'" % package_version |
25 print 'Presumably you are intentionally building without NativeClient.' | 22 print 'Presumably you are intentionally building without NativeClient.' |
26 print 'Skipping NativeClient toolchain download.' | 23 print 'Skipping NativeClient toolchain download.' |
(...skipping 23 matching lines...) Expand all Loading... |
50 if 'target_arch=arm' not in os.environ.get('GYP_DEFINES', ''): | 47 if 'target_arch=arm' not in os.environ.get('GYP_DEFINES', ''): |
51 args = ['--exclude', 'nacl_arm_newlib'] + args | 48 args = ['--exclude', 'nacl_arm_newlib'] + args |
52 | 49 |
53 package_version.main(args) | 50 package_version.main(args) |
54 | 51 |
55 return 0 | 52 return 0 |
56 | 53 |
57 | 54 |
58 if __name__ == '__main__': | 55 if __name__ == '__main__': |
59 sys.exit(Main(sys.argv[1:])) | 56 sys.exit(Main(sys.argv[1:])) |
OLD | NEW |