| 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 """Prints "1" if Chrome targets should be built with hermetic xcode. Otherwise | 6 """ |
| 7 prints "0". | 7 Prints "1" if Chrome targets should be built with hermetic Xcode. |
| 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". |
| 8 | 11 |
| 9 Usage: | 12 Usage: |
| 10 python should_use_hermetic_xcode.py <target_os> | 13 python should_use_hermetic_xcode.py <target_os> |
| 11 """ | 14 """ |
| 12 | 15 |
| 13 import os | 16 import os |
| 14 import sys | 17 import sys |
| 15 | 18 |
| 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 |
| 16 | 25 |
| 17 def _IsCorpMachine(): | 26 def _IsCorpMachine(): |
| 18 return os.path.isdir('/Library/GoogleCorpSupport/') | 27 return os.path.isdir('/Library/GoogleCorpSupport/') |
| 19 | 28 |
| 20 | 29 |
| 21 def main(): | 30 def main(): |
| 22 allow_corp = sys.argv[1] == 'mac' and _IsCorpMachine() | 31 allow_corp = sys.argv[1] == 'mac' and _IsCorpMachine() |
| 23 if os.environ.get('FORCE_MAC_TOOLCHAIN') or allow_corp: | 32 if os.environ.get('FORCE_MAC_TOOLCHAIN') or allow_corp: |
| 33 if not mac_toolchain.PlatformMeetsHermeticXcodeRequirements(sys.argv[1]): |
| 34 return "2" |
| 24 return "1" | 35 return "1" |
| 25 else: | 36 else: |
| 26 return "0" | 37 return "0" |
| 27 | 38 |
| 28 | 39 |
| 29 if __name__ == '__main__': | 40 if __name__ == '__main__': |
| 30 print main() | 41 print main() |
| 31 sys.exit(0) | 42 sys.exit(0) |
| OLD | NEW |