OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 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 """ | 6 """Prints "1" if Chrome targets should be built with hermetic xcode. Otherwise |
7 Prints "1" if Chrome targets should be built with hermetic Xcode. | 7 prints "0". |
8 Prints "2" if Chrome targets should be built with hermetic Xcode, but the OS | |
9 version does not meet the minimum requirements of the hermetic version of Xcode. | |
10 Otherwise prints "0". | |
11 | 8 |
12 Usage: | 9 Usage: |
13 python should_use_hermetic_xcode.py <target_os> | 10 python should_use_hermetic_xcode.py <target_os> |
14 """ | 11 """ |
15 | 12 |
16 import os | 13 import os |
17 import sys | 14 import sys |
18 | 15 |
19 _THIS_DIR_PATH = os.path.abspath(os.path.dirname(os.path.realpath(__file__))) | |
20 _BUILD_PATH = os.path.join(_THIS_DIR_PATH, os.pardir) | |
21 sys.path.insert(0, _BUILD_PATH) | |
22 | |
23 import mac_toolchain | |
24 | |
25 | 16 |
26 def _IsCorpMachine(): | 17 def _IsCorpMachine(): |
27 return os.path.isdir('/Library/GoogleCorpSupport/') | 18 return os.path.isdir('/Library/GoogleCorpSupport/') |
28 | 19 |
29 | 20 |
30 def main(): | 21 def main(): |
31 allow_corp = sys.argv[1] == 'mac' and _IsCorpMachine() | 22 allow_corp = sys.argv[1] == 'mac' and _IsCorpMachine() |
32 if os.environ.get('FORCE_MAC_TOOLCHAIN') or allow_corp: | 23 if os.environ.get('FORCE_MAC_TOOLCHAIN') or allow_corp: |
33 if not mac_toolchain.PlatformMeetsHermeticXcodeRequirements(sys.argv[1]): | |
34 return "2" | |
35 return "1" | 24 return "1" |
36 else: | 25 else: |
37 return "0" | 26 return "0" |
38 | 27 |
39 | 28 |
40 if __name__ == '__main__': | 29 if __name__ == '__main__': |
41 print main() | 30 print main() |
42 sys.exit(0) | 31 sys.exit(0) |
OLD | NEW |