Chromium Code Reviews| 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 """Meta checkout manager supporting both Subversion and GIT. | 6 """Meta checkout manager supporting both Subversion and GIT. |
| 7 | 7 |
| 8 Files | 8 Files |
| 9 .gclient : Current client configuration, written by 'config' command. | 9 .gclient : Current client configuration, written by 'config' command. |
| 10 Format is a Python script defining 'solutions', a list whose | 10 Format is a Python script defining 'solutions', a list whose |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 "action": ["python", "image_indexer.py", "--all"]}, | 48 "action": ["python", "image_indexer.py", "--all"]}, |
| 49 ] | 49 ] |
| 50 | 50 |
| 51 Specifying a target OS | 51 Specifying a target OS |
| 52 An optional key named "target_os" may be added to a gclient file to specify | 52 An optional key named "target_os" may be added to a gclient file to specify |
| 53 one or more additional operating systems that should be considered when | 53 one or more additional operating systems that should be considered when |
| 54 processing the deps_os dict of a DEPS file. | 54 processing the deps_os dict of a DEPS file. |
| 55 | 55 |
| 56 Example: | 56 Example: |
| 57 target_os = [ "android" ] | 57 target_os = [ "android" ] |
| 58 | |
| 59 If the "target_os_only" key is also present and true, then *only* the | |
| 60 operating systems listed in "target_os" will be used. If "target_os" is not | |
| 61 present, "target_os_only" has no effect. | |
| 62 | |
| 63 Example: | |
| 64 target_os = [ "ios" ] | |
| 65 target_os_only = True | |
| 58 """ | 66 """ |
| 59 | 67 |
| 60 __version__ = "0.6.4" | 68 __version__ = "0.6.4" |
| 61 | 69 |
| 62 import copy | 70 import copy |
| 63 import logging | 71 import logging |
| 64 import optparse | 72 import optparse |
| 65 import os | 73 import os |
| 66 import platform | 74 import platform |
| 67 import posixpath | 75 import posixpath |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 879 assert not self.dependencies | 887 assert not self.dependencies |
| 880 config_dict = {} | 888 config_dict = {} |
| 881 self.config_content = content | 889 self.config_content = content |
| 882 try: | 890 try: |
| 883 exec(content, config_dict) | 891 exec(content, config_dict) |
| 884 except SyntaxError, e: | 892 except SyntaxError, e: |
| 885 gclient_utils.SyntaxErrorToError('.gclient', e) | 893 gclient_utils.SyntaxErrorToError('.gclient', e) |
| 886 | 894 |
| 887 # Append any target OS that is not already being enforced to the tuple. | 895 # Append any target OS that is not already being enforced to the tuple. |
| 888 target_os = config_dict.get('target_os', []) | 896 target_os = config_dict.get('target_os', []) |
| 889 self._enforced_os = tuple(set(self._enforced_os).union(target_os)) | 897 if len(target_os) > 0 and config_dict.get('target_os_only', False): |
|
M-A Ruel
2012/11/02 12:07:21
if target_os and ...
will work just fine.
in fact
stuartmorgan
2012/11/02 12:36:12
Good call; done (and test updated to check that it
| |
| 898 self._enforced_os = tuple(set(target_os)) | |
| 899 else: | |
| 900 self._enforced_os = tuple(set(self._enforced_os).union(target_os)) | |
| 890 | 901 |
| 891 deps_to_add = [] | 902 deps_to_add = [] |
| 892 for s in config_dict.get('solutions', []): | 903 for s in config_dict.get('solutions', []): |
| 893 try: | 904 try: |
| 894 deps_to_add.append(Dependency( | 905 deps_to_add.append(Dependency( |
| 895 self, s['name'], s['url'], | 906 self, s['name'], s['url'], |
| 896 s.get('safesync_url', None), | 907 s.get('safesync_url', None), |
| 897 s.get('managed', True), | 908 s.get('managed', True), |
| 898 s.get('custom_deps', {}), | 909 s.get('custom_deps', {}), |
| 899 s.get('custom_vars', {}), | 910 s.get('custom_vars', {}), |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1659 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 1670 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
| 1660 print >> sys.stderr, 'Error: %s' % str(e) | 1671 print >> sys.stderr, 'Error: %s' % str(e) |
| 1661 return 1 | 1672 return 1 |
| 1662 | 1673 |
| 1663 | 1674 |
| 1664 if '__main__' == __name__: | 1675 if '__main__' == __name__: |
| 1665 fix_encoding.fix_encoding() | 1676 fix_encoding.fix_encoding() |
| 1666 sys.exit(Main(sys.argv[1:])) | 1677 sys.exit(Main(sys.argv[1:])) |
| 1667 | 1678 |
| 1668 # vim: ts=2:sw=2:tw=80:et: | 1679 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |