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 29 matching lines...) Expand all Loading... |
40 the current Python interpreter (sys.executable) will be used | 40 the current Python interpreter (sys.executable) will be used |
41 to run the command. If the list contains string "$matching_files" | 41 to run the command. If the list contains string "$matching_files" |
42 it will be removed from the list and the list will be extended | 42 it will be removed from the list and the list will be extended |
43 by the list of matching files. | 43 by the list of matching files. |
44 | 44 |
45 Example: | 45 Example: |
46 hooks = [ | 46 hooks = [ |
47 { "pattern": "\\.(gif|jpe?g|pr0n|png)$", | 47 { "pattern": "\\.(gif|jpe?g|pr0n|png)$", |
48 "action": ["python", "image_indexer.py", "--all"]}, | 48 "action": ["python", "image_indexer.py", "--all"]}, |
49 ] | 49 ] |
| 50 |
| 51 Specifying a target OS |
| 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 |
| 54 processing the deps_os dict of a DEPS file. |
| 55 |
| 56 Example: |
| 57 target_os = [ "android" ] |
50 """ | 58 """ |
51 | 59 |
52 __version__ = "0.6.4" | 60 __version__ = "0.6.4" |
53 | 61 |
54 import copy | 62 import copy |
55 import logging | 63 import logging |
56 import optparse | 64 import optparse |
57 import os | 65 import os |
58 import platform | 66 import platform |
59 import posixpath | 67 import posixpath |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 | 844 |
837 def SetConfig(self, content): | 845 def SetConfig(self, content): |
838 assert not self.dependencies | 846 assert not self.dependencies |
839 config_dict = {} | 847 config_dict = {} |
840 self.config_content = content | 848 self.config_content = content |
841 try: | 849 try: |
842 exec(content, config_dict) | 850 exec(content, config_dict) |
843 except SyntaxError, e: | 851 except SyntaxError, e: |
844 gclient_utils.SyntaxErrorToError('.gclient', e) | 852 gclient_utils.SyntaxErrorToError('.gclient', e) |
845 | 853 |
| 854 # Append any target OS that is not already being enforced to the tuple. |
| 855 target_os = config_dict.get('target_os', []) |
| 856 self._enforced_os = tuple(set(self._enforced_os).union(target_os)) |
| 857 |
846 deps_to_add = [] | 858 deps_to_add = [] |
847 for s in config_dict.get('solutions', []): | 859 for s in config_dict.get('solutions', []): |
848 try: | 860 try: |
849 deps_to_add.append(Dependency( | 861 deps_to_add.append(Dependency( |
850 self, s['name'], s['url'], | 862 self, s['name'], s['url'], |
851 s.get('safesync_url', None), | 863 s.get('safesync_url', None), |
852 s.get('managed', True), | 864 s.get('managed', True), |
853 s.get('custom_deps', {}), | 865 s.get('custom_deps', {}), |
854 s.get('custom_vars', {}), | 866 s.get('custom_vars', {}), |
855 s.get('deps_file', 'DEPS'), | 867 s.get('deps_file', 'DEPS'), |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 1597 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
1586 print >> sys.stderr, 'Error: %s' % str(e) | 1598 print >> sys.stderr, 'Error: %s' % str(e) |
1587 return 1 | 1599 return 1 |
1588 | 1600 |
1589 | 1601 |
1590 if '__main__' == __name__: | 1602 if '__main__' == __name__: |
1591 fix_encoding.fix_encoding() | 1603 fix_encoding.fix_encoding() |
1592 sys.exit(Main(sys.argv[1:])) | 1604 sys.exit(Main(sys.argv[1:])) |
1593 | 1605 |
1594 # vim: ts=2:sw=2:tw=80:et: | 1606 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |