Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Side by Side Diff: gclient.py

Issue 11363036: Allow specificying that only target_os should be used in a gclient file (Closed) Base URL: https://git.chromium.org/chromium/tools/depot_tools.git@master
Patch Set: Make invalid combinations fatal Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/gclient_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.
61
62 Example:
63 target_os = [ "ios" ]
64 target_os_only = True
58 """ 65 """
59 66
60 __version__ = "0.6.4" 67 __version__ = "0.6.4"
61 68
62 import copy 69 import copy
63 import logging 70 import logging
64 import optparse 71 import optparse
65 import os 72 import os
66 import platform 73 import platform
67 import posixpath 74 import posixpath
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 assert not self.dependencies 886 assert not self.dependencies
880 config_dict = {} 887 config_dict = {}
881 self.config_content = content 888 self.config_content = content
882 try: 889 try:
883 exec(content, config_dict) 890 exec(content, config_dict)
884 except SyntaxError, e: 891 except SyntaxError, e:
885 gclient_utils.SyntaxErrorToError('.gclient', e) 892 gclient_utils.SyntaxErrorToError('.gclient', e)
886 893
887 # Append any target OS that is not already being enforced to the tuple. 894 # Append any target OS that is not already being enforced to the tuple.
888 target_os = config_dict.get('target_os', []) 895 target_os = config_dict.get('target_os', [])
889 self._enforced_os = tuple(set(self._enforced_os).union(target_os)) 896 if config_dict.get('target_os_only', False):
897 self._enforced_os = tuple(set(target_os))
898 else:
899 self._enforced_os = tuple(set(self._enforced_os).union(target_os))
900
901 if not target_os and config_dict.get('target_os_only', False):
902 raise gclient_utils.Error('Can\'t use target_os_only if target_os is '
903 'not specified')
890 904
891 deps_to_add = [] 905 deps_to_add = []
892 for s in config_dict.get('solutions', []): 906 for s in config_dict.get('solutions', []):
893 try: 907 try:
894 deps_to_add.append(Dependency( 908 deps_to_add.append(Dependency(
895 self, s['name'], s['url'], 909 self, s['name'], s['url'],
896 s.get('safesync_url', None), 910 s.get('safesync_url', None),
897 s.get('managed', True), 911 s.get('managed', True),
898 s.get('custom_deps', {}), 912 s.get('custom_deps', {}),
899 s.get('custom_vars', {}), 913 s.get('custom_vars', {}),
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 except (gclient_utils.Error, subprocess2.CalledProcessError), e: 1673 except (gclient_utils.Error, subprocess2.CalledProcessError), e:
1660 print >> sys.stderr, 'Error: %s' % str(e) 1674 print >> sys.stderr, 'Error: %s' % str(e)
1661 return 1 1675 return 1
1662 1676
1663 1677
1664 if '__main__' == __name__: 1678 if '__main__' == __name__:
1665 fix_encoding.fix_encoding() 1679 fix_encoding.fix_encoding()
1666 sys.exit(Main(sys.argv[1:])) 1680 sys.exit(Main(sys.argv[1:]))
1667 1681
1668 # vim: ts=2:sw=2:tw=80:et: 1682 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « no previous file | tests/gclient_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698