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

Side by Side Diff: site_scons/site_tools/component_targets.py

Issue 13134: Pulling in hammer changes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years 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 | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/python2.4 1 #!/usr/bin/python2.4
2 # Copyright 2008, Google Inc. 2 # Copyright 2008, Google Inc.
3 # All rights reserved. 3 # All rights reserved.
4 # 4 #
5 # Redistribution and use in source and binary forms, with or without 5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are 6 # modification, are permitted provided that the following conditions are
7 # met: 7 # met:
8 # 8 #
9 # * Redistributions of source code must retain the above copyright 9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer. 10 # notice, this list of conditions and the following disclaimer.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 #------------------------------------------------------------------------------ 107 #------------------------------------------------------------------------------
108 108
109 109
110 def AddTargetGroup(name, description): 110 def AddTargetGroup(name, description):
111 """Adds a target group, used for printing help. 111 """Adds a target group, used for printing help.
112 112
113 Args: 113 Args:
114 name: Name of target group. This should be the name of an alias which 114 name: Name of target group. This should be the name of an alias which
115 points to other aliases for the specific targets. 115 points to other aliases for the specific targets.
116 description: Description of the target group. 116 description: Description of the target group. Should read properly when
117 appended to 'The following ' - for example, 'programs can be built'.
117 """ 118 """
118 119
119 # Warn if the target group already exists with a different description 120 # Warn if the target group already exists with a different description
120 if (name in __target_groups 121 if (name in __target_groups
121 and __target_groups[name].description != description): 122 and __target_groups[name].description != description):
122 print ('Warning: Changing description of target group "%s" from "%s" to ' 123 print ('Warning: Changing description of target group "%s" from "%s" to '
123 '"%s"' % (name, __target_groups[name].description, description)) 124 '"%s"' % (name, __target_groups[name].description, description))
124 __target_groups[name].description = description 125 __target_groups[name].description = description
125 else: 126 else:
126 __target_groups[name] = TargetGroup(name, description) 127 __target_groups[name] = TargetGroup(name, description)
(...skipping 13 matching lines...) Expand all
140 141
141 def GetTargetModes(): 142 def GetTargetModes():
142 """Gets the dict of target modes. 143 """Gets the dict of target modes.
143 144
144 Returns: 145 Returns:
145 The dict of target modes, indexed by mode name. 146 The dict of target modes, indexed by mode name.
146 147
147 This dict is not fully populated until after BuildEnvironments() has been 148 This dict is not fully populated until after BuildEnvironments() has been
148 called. 149 called.
149 """ 150 """
151 # TODO(rspangler): Better to rename this to # GetTargetBuildEnvironments()?
152 # That's a more description name.
150 return __target_modes 153 return __target_modes
151 154
152 155
153 def GetTargets(): 156 def GetTargets():
154 """Gets the dict of targets. 157 """Gets the dict of targets.
155 158
156 Returns: 159 Returns:
157 The dict of targets, indexed by target name. 160 The dict of targets, indexed by target name.
158 161
159 This dict is not fully populated until after BuildEnvironments() has been 162 This dict is not fully populated until after BuildEnvironments() has been
(...skipping 30 matching lines...) Expand all
190 if mode not in target.mode_properties: 193 if mode not in target.mode_properties:
191 target.mode_properties[mode] = {} 194 target.mode_properties[mode] = {}
192 add_to_dict = target.mode_properties[mode] 195 add_to_dict = target.mode_properties[mode]
193 196
194 # Add values 197 # Add values
195 for k, v in kwargs.items(): 198 for k, v in kwargs.items():
196 add_to_dict[k] = self.subst(str(v)) 199 add_to_dict[k] = self.subst(str(v))
197 200
198 201
199 def AddTargetHelp(): 202 def AddTargetHelp():
200 """Adds help for the targets, groups, and modes.""" 203 """Adds SCons help for the targets, groups, and modes.
204
205 This is called automatically by BuildEnvironments()."""
201 help_text = '' 206 help_text = ''
202 207
203 for group in GetTargetGroups().values(): 208 for group in GetTargetGroups().values():
204 items = group.GetTargetNames() 209 items = group.GetTargetNames()
205 items.sort() 210 items.sort()
206 if items: 211 if items:
207 help_text += '\nThe following %s:' % group.description 212 help_text += '\nThe following %s:' % group.description
208 colwidth = max(map(len, items)) + 2 213 colwidth = max(map(len, items)) + 2
209 cols = 77 / colwidth 214 cols = 77 / colwidth
210 if cols < 1: 215 if cols < 1:
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 __builtin__.AddTargetHelp = AddTargetHelp 260 __builtin__.AddTargetHelp = AddTargetHelp
256 __builtin__.GetTargetGroups = GetTargetGroups 261 __builtin__.GetTargetGroups = GetTargetGroups
257 __builtin__.GetTargetModes = GetTargetModes 262 __builtin__.GetTargetModes = GetTargetModes
258 __builtin__.GetTargets = GetTargets 263 __builtin__.GetTargets = GetTargets
259 264
260 env.AddMethod(SetTargetDescription) 265 env.AddMethod(SetTargetDescription)
261 env.AddMethod(SetTargetProperty) 266 env.AddMethod(SetTargetProperty)
262 267
263 # Defer per-mode setup 268 # Defer per-mode setup
264 env.Defer(AddTargetMode) 269 env.Defer(AddTargetMode)
OLDNEW
« no previous file with comments | « site_scons/site_tools/component_setup.py ('k') | site_scons/site_tools/component_targets_msvs.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698