| OLD | NEW |
| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 """Software construction toolkit site_scons configuration. | 31 """Software construction toolkit site_scons configuration. |
| 32 | 32 |
| 33 This module sets up SCons for use with this toolkit. This should contain setup | 33 This module sets up SCons for use with this toolkit. This should contain setup |
| 34 which occurs outside of environments. If a method operates within the context | 34 which occurs outside of environments. If a method operates within the context |
| 35 of an environment, it should instead go in a tool in site_tools and be invoked | 35 of an environment, it should instead go in a tool in site_tools and be invoked |
| 36 for the target environment. | 36 for the target environment. |
| 37 """ | 37 """ |
| 38 | 38 |
| 39 import __builtin__ | 39 import __builtin__ |
| 40 import os | |
| 41 import sys | 40 import sys |
| 42 import SCons | 41 import SCons |
| 43 | 42 |
| 44 | 43 |
| 45 # List of target groups for printing help; modified by AddTargetGroup(); used | |
| 46 # by BuildEnvironments(). | |
| 47 __target_groups = {} | |
| 48 | |
| 49 | |
| 50 def _HostPlatform(): | 44 def _HostPlatform(): |
| 51 """Returns the current host platform. | 45 """Returns the current host platform. |
| 52 | 46 |
| 53 That is, the platform we're actually running SCons on. You shouldn't use | 47 That is, the platform we're actually running SCons on. You shouldn't use |
| 54 this inside your SConscript files; instead, include the appropriate | 48 this inside your SConscript files; instead, include the appropriate |
| 55 target_platform tool for your environments. When you call | 49 target_platform tool for your environments. When you call |
| 56 BuildEnvironments(), only environments with the current host platform will be | 50 BuildEnvironments(), only environments with the current host platform will be |
| 57 built. | 51 built. |
| 58 | 52 |
| 59 Returns: | 53 Returns: |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 if g not in all_build_groups: | 105 if g not in all_build_groups: |
| 112 all_build_groups[g] = [] | 106 all_build_groups[g] = [] |
| 113 # Don't allow build types and groups to share names | 107 # Don't allow build types and groups to share names |
| 114 if g in all_build_types: | 108 if g in all_build_types: |
| 115 raise ValueError('Build group %s also specified as BUILD_TYPE.' % g) | 109 raise ValueError('Build group %s also specified as BUILD_TYPE.' % g) |
| 116 else: | 110 else: |
| 117 all_build_types.append(g) | 111 all_build_types.append(g) |
| 118 all_build_groups[g].append(e['BUILD_TYPE']) | 112 all_build_groups[g].append(e['BUILD_TYPE']) |
| 119 | 113 |
| 120 # Add help for build types | 114 # Add help for build types |
| 121 xml_help = SCons.Script.GetOption('xml_help') | 115 help_text = ''' |
| 122 if xml_help: | |
| 123 help_mode_format = ' <build_mode name="%s"><![CDATA[%s]]></build_mode>\n' | |
| 124 help_text = '<mode_list>\n' | |
| 125 else: | |
| 126 help_text = ''' | |
| 127 Use --mode=type to specify the type of build to perform. The following types | 116 Use --mode=type to specify the type of build to perform. The following types |
| 128 may be specified: | 117 may be specified: |
| 129 ''' | 118 ''' |
| 130 help_mode_format = ' %-16s %s\n' | |
| 131 | 119 |
| 132 for build_type in all_build_types: | 120 for build_type in all_build_types: |
| 133 if build_type not in all_build_groups: | 121 if build_type not in all_build_groups: |
| 134 help_text += help_mode_format % ( | 122 help_text += ' %-16s %s\n' % ( |
| 135 build_type, build_desc.get(build_type, '')) | 123 build_type, build_desc.get(build_type, '')) |
| 136 | 124 |
| 137 if xml_help: | 125 help_text += ''' |
| 138 help_group_format = (' <build_group name="%s"><![CDATA[%s]]>' | |
| 139 '</build_group>\n') | |
| 140 help_text += '</mode_list>\n<group_list>\n' | |
| 141 else: | |
| 142 help_group_format = ' %-16s %s\n' | |
| 143 help_text += ''' | |
| 144 The following build groups may also be specified via --mode. Build groups | 126 The following build groups may also be specified via --mode. Build groups |
| 145 build one or more of the other build types. The available build groups are: | 127 build one or more of the other build types. The available build groups are: |
| 146 ''' | 128 ''' |
| 147 | 129 |
| 148 groups_sorted = all_build_groups.keys() | 130 groups_sorted = all_build_groups.keys() |
| 149 groups_sorted.sort() | 131 groups_sorted.sort() |
| 150 for g in groups_sorted: | 132 for g in groups_sorted: |
| 151 help_text += help_group_format % (g, ','.join(all_build_groups[g])) | 133 help_text += ' %-16s %s\n' % (g, ','.join(all_build_groups[g])) |
| 152 | 134 |
| 153 if xml_help: | 135 help_text += ''' |
| 154 help_text += '</group_list>\n' | |
| 155 else: | |
| 156 help_text += ''' | |
| 157 Multiple modes may be specified, separated by commas: --mode=mode1,mode2. If | 136 Multiple modes may be specified, separated by commas: --mode=mode1,mode2. If |
| 158 no mode is specified, the default group will be built. This is equivalent to | 137 no mode is specified, the default group will be built. This is equivalent to |
| 159 specifying --mode=default. | 138 specifying --mode=default. |
| 160 ''' | 139 ''' |
| 161 SCons.Script.Help(help_text) | 140 SCons.Script.Help(help_text) |
| 162 | 141 |
| 163 # Make sure all build modes specified by the user are ones which apply to | 142 # Make sure all build modes specified by the user are ones which apply to |
| 164 # the current environment. | 143 # the current environment. |
| 165 for mode in build_modes: | 144 for mode in build_modes: |
| 166 if mode not in all_build_types and mode not in all_build_groups: | 145 if mode not in all_build_types and mode not in all_build_groups: |
| 167 print ('Warning: Ignoring build mode "%s", which is not defined on this ' | 146 print ('Warning: Ignoring build mode "%s", which is not defined on this ' |
| 168 'platform.' % mode) | 147 'platform.' % mode) |
| 169 | 148 |
| 170 | 149 |
| 171 def _AddTargetHelp(): | 150 #------------------------------------------------------------------------------ |
| 172 """Adds help for the target groups from the global __target_groups.""" | |
| 173 xml_help = SCons.Script.GetOption('xml_help') | |
| 174 help_text = '' | |
| 175 | 151 |
| 176 for alias, description in __target_groups.items(): | |
| 177 items = map(str, SCons.Script.Alias(alias)[0].sources) | |
| 178 # Remove duplicates from multiple environments | |
| 179 items = list(set(items)) | |
| 180 | 152 |
| 181 if items: | 153 def BuildEnvironmentSConscripts(env): |
| 182 colwidth = max(map(len, items)) + 2 | 154 """Evaluates SConscripts for the environment. |
| 183 cols = 77 / colwidth | |
| 184 if cols < 1: | |
| 185 cols = 1 # If target names are really long, one per line | |
| 186 rows = (len(items) + cols - 1) / cols | |
| 187 items.sort() | |
| 188 if xml_help: | |
| 189 help_text += '<target_group name="%s">\n' % alias | |
| 190 for i in items: | |
| 191 help_text += ' <build_target name="%s"/>\n' % i | |
| 192 help_text += '</target_group>\n' | |
| 193 else: | |
| 194 help_text += '\nThe following %s:' % description | |
| 195 for row in range(0, rows): | |
| 196 help_text += '\n ' | |
| 197 for i in range(row, len(items), rows): | |
| 198 help_text += '%-*s' % (colwidth, items[i]) | |
| 199 help_text += '\n %s (do all of the above)\n' % alias | |
| 200 | 155 |
| 201 SCons.Script.Help(help_text) | 156 Called by BuildEnvironments(). |
| 157 """ |
| 158 # Read SConscript for each component |
| 159 # TODO(rspangler): Remove BUILD_COMPONENTS once all projects have |
| 160 # transitioned to the BUILD_SCONSCRIPTS nomenclature. |
| 161 for c in env.SubstList2('$BUILD_SCONSCRIPTS', '$BUILD_COMPONENTS'): |
| 162 # Clone the environment so components can't interfere with each other |
| 163 ec = env.Clone() |
| 202 | 164 |
| 203 #------------------------------------------------------------------------------ | 165 if ec.Entry(c).isdir(): |
| 166 # The component is a directory, so assume it contains a SConscript |
| 167 # file. |
| 168 c_dir = ec.Dir(c) |
| 169 |
| 170 # Use 'build.scons' as the default filename, but if that doesn't |
| 171 # exist, fall back to 'SConscript'. |
| 172 c_script = c_dir.File('build.scons') |
| 173 if not c_script.exists(): |
| 174 c_script = c_dir.File('SConscript') |
| 175 else: |
| 176 # The component is a SConscript file. |
| 177 c_script = ec.File(c) |
| 178 c_dir = c_script.dir |
| 179 |
| 180 # Make c_dir a string. |
| 181 c_dir = str(c_dir) |
| 182 |
| 183 # Use build_dir differently depending on where the SConscript is. |
| 184 if not ec.RelativePath('$TARGET_ROOT', c_dir).startswith('..'): |
| 185 # The above expression means: if c_dir is $TARGET_ROOT or anything |
| 186 # under it. Going from c_dir to $TARGET_ROOT and dropping the not fails |
| 187 # to include $TARGET_ROOT. |
| 188 # We want to be able to allow people to use addRepository to back things |
| 189 # under $TARGET_ROOT/$OBJ_ROOT with things from above the current |
| 190 # directory. When we are passed a SConscript that is already under |
| 191 # $TARGET_ROOT, we should not use build_dir. |
| 192 ec.SConscript(c_script, exports={'env': ec}, duplicate=0) |
| 193 elif not ec.RelativePath('$MAIN_DIR', c_dir).startswith('..'): |
| 194 # The above expression means: if c_dir is $MAIN_DIR or anything |
| 195 # under it. Going from c_dir to $TARGET_ROOT and dropping the not fails |
| 196 # to include $MAIN_DIR. |
| 197 # Also, if we are passed a SConscript that |
| 198 # is not under $MAIN_DIR, we should fail loudly, because it is unclear how |
| 199 # this will correspond to things under $OBJ_ROOT. |
| 200 ec.SConscript(c_script, build_dir='$OBJ_ROOT/' + c_dir, |
| 201 exports={'env': ec}, duplicate=0) |
| 202 else: |
| 203 raise SCons.Error.UserError( |
| 204 'Bad location for a SConscript. "%s" is not under ' |
| 205 '\$TARGET_ROOT or \$MAIN_DIR' % c_script) |
| 204 | 206 |
| 205 | 207 |
| 206 def BuildEnvironments(environments): | 208 def BuildEnvironments(environments): |
| 207 """Build a collection of SConscripts under a collection of environments. | 209 """Build a collection of SConscripts under a collection of environments. |
| 208 | 210 |
| 209 Only environments with HOST_PLATFORMS containing the platform specified by | 211 Only environments with HOST_PLATFORMS containing the platform specified by |
| 210 --host-platform (or the native host platform, if --host-platform was not | 212 --host-platform (or the native host platform, if --host-platform was not |
| 211 specified) will be matched. | 213 specified) will be matched. |
| 212 | 214 |
| 213 Each matching environment is checked against the modes passed to the --mode | 215 Each matching environment is checked against the modes passed to the --mode |
| 214 command line argument (or 'default', if no mode(s) were specified). If any | 216 command line argument (or 'default', if no mode(s) were specified). If any |
| 215 of the modes match the environment's BUILD_TYPE or any of the environment's | 217 of the modes match the environment's BUILD_TYPE or any of the environment's |
| 216 BUILD_GROUPS, all the BUILD_SCONSCRIPTS (and for legacy reasons, | 218 BUILD_GROUPS, all the BUILD_SCONSCRIPTS (and for legacy reasons, |
| 217 BUILD_COMPONENTS) in that environment will be built. | 219 BUILD_COMPONENTS) in that environment will be built. |
| 218 | 220 |
| 219 Args: | 221 Args: |
| 220 environments: List of SCons environments. | 222 environments: List of SCons environments. |
| 221 | 223 |
| 222 Returns: | 224 Returns: |
| 223 List of environments which were actually evaluated (built). | 225 List of environments which were actually evaluated (built). |
| 224 """ | 226 """ |
| 225 # Get options | 227 # Get options |
| 226 xml_help = SCons.Script.GetOption('xml_help') | |
| 227 build_modes = SCons.Script.GetOption('build_mode') | 228 build_modes = SCons.Script.GetOption('build_mode') |
| 228 # TODO(rspangler): Remove support legacy MODE= argument, once everyone has | 229 # TODO(rspangler): Remove support legacy MODE= argument, once everyone has |
| 229 # transitioned to --mode. | 230 # transitioned to --mode. |
| 230 legacy_mode_option = SCons.Script.ARGUMENTS.get('MODE') | 231 legacy_mode_option = SCons.Script.ARGUMENTS.get('MODE') |
| 231 if legacy_mode_option: | 232 if legacy_mode_option: |
| 232 build_modes = legacy_mode_option | 233 build_modes = legacy_mode_option |
| 233 build_modes = build_modes.split(',') | 234 build_modes = build_modes.split(',') |
| 234 | 235 |
| 235 host_platform = SCons.Script.GetOption('host_platform') | 236 host_platform = SCons.Script.GetOption('host_platform') |
| 236 if not host_platform: | 237 if not host_platform: |
| 237 host_platform = _HostPlatform() | 238 host_platform = _HostPlatform() |
| 238 | 239 |
| 239 # Check build modes | 240 # Check build modes |
| 240 _CheckBuildModes(build_modes, environments, host_platform) | 241 _CheckBuildModes(build_modes, environments, host_platform) |
| 241 | 242 |
| 242 if xml_help: | |
| 243 SCons.Script.Help('<help_from_sconscripts>\n<![CDATA[\n') | |
| 244 | |
| 245 environments_to_evaluate = [] | 243 environments_to_evaluate = [] |
| 246 for e in environments: | 244 for e in environments: |
| 247 if not e.Overlap(e['HOST_PLATFORMS'], [host_platform, '*']): | 245 if not e.Overlap(e['HOST_PLATFORMS'], [host_platform, '*']): |
| 248 continue # Environment requires a host platform which isn't us | 246 continue # Environment requires a host platform which isn't us |
| 249 | 247 |
| 250 if e.Overlap([e['BUILD_TYPE'], e['BUILD_GROUPS']], build_modes): | 248 if e.Overlap([e['BUILD_TYPE'], e['BUILD_GROUPS']], build_modes): |
| 251 environments_to_evaluate.append(e) | 249 environments_to_evaluate.append(e) |
| 252 | 250 |
| 253 for e in environments_to_evaluate: | 251 for e in environments_to_evaluate: |
| 254 # Set up for deferred functions and published resources | 252 # Make this the root environment for deferred functions, so they don't |
| 255 e._InitializeComponentBuilders() | 253 # execute until our call to ExecuteDefer(). |
| 256 e._InitializeDefer() | 254 e.SetDeferRoot() |
| 257 e._InitializePublish() | |
| 258 | 255 |
| 259 # Read SConscript for each component | 256 # Defer building the SConscripts, so that other tools can do |
| 260 # TODO(rspangler): Remove BUILD_COMPONENTS once all projects have | 257 # per-environment setup first. |
| 261 # transitioned to the BUILD_SCONSCRIPTS nomenclature. | 258 e.Defer(BuildEnvironmentSConscripts) |
| 262 for c in e.get('BUILD_COMPONENTS', []) + e.get('BUILD_SCONSCRIPTS', []): | |
| 263 # Clone the environment so components can't interfere with each other | |
| 264 ec = e.Clone() | |
| 265 | |
| 266 if ec.Entry(c).isdir(): | |
| 267 # The component is a directory, so assume it contains a SConscript | |
| 268 # file. | |
| 269 c_dir = ec.Dir(c) | |
| 270 | |
| 271 # Use 'build.scons' as the default filename, but if that doesn't | |
| 272 # exist, fall back to 'SConscript'. | |
| 273 c_script = c_dir.File('build.scons') | |
| 274 if not c_script.exists(): | |
| 275 c_script = c_dir.File('SConscript') | |
| 276 else: | |
| 277 # The component is a SConscript file. | |
| 278 c_script = ec.File(c) | |
| 279 c_dir = c_script.dir | |
| 280 | |
| 281 # TODO(bradnelson): this hack is not in mainline. | |
| 282 # Need to unify how to do this sort of thing. | |
| 283 c_dir = str(c_dir) | |
| 284 if os.path.isabs(c_dir): | |
| 285 build_dir = None | |
| 286 else: | |
| 287 build_dir = '$OBJ_ROOT/' + c_dir | |
| 288 ec.SConscript(c_script, | |
| 289 build_dir=build_dir, | |
| 290 exports={'env': ec}, | |
| 291 duplicate=0) | |
| 292 | 259 |
| 293 # Execute deferred functions | 260 # Execute deferred functions |
| 294 e._ExecuteDefer() | 261 e.ExecuteDefer() |
| 295 | 262 |
| 296 if xml_help: | 263 # Add help on targets. |
| 297 SCons.Script.Help(']]>\n</help_from_sconscripts>\n') | 264 AddTargetHelp() |
| 298 | |
| 299 _AddTargetHelp() | |
| 300 | |
| 301 # End final help tag | |
| 302 if xml_help: | |
| 303 SCons.Script.Help('</help>\n') | |
| 304 | 265 |
| 305 # Return list of environments actually evaluated | 266 # Return list of environments actually evaluated |
| 306 return environments_to_evaluate | 267 return environments_to_evaluate |
| 307 | 268 |
| 308 | 269 |
| 309 #------------------------------------------------------------------------------ | 270 #------------------------------------------------------------------------------ |
| 310 | 271 |
| 311 | 272 |
| 312 def _ToolExists(): | 273 def _ToolExists(): |
| 313 """Replacement for SCons tool module exists() function, if one isn't present. | 274 """Replacement for SCons tool module exists() function, if one isn't present. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 directory for a project. This does the following: | 307 directory for a project. This does the following: |
| 347 * Adds site_dir/site_scons to sys.path. | 308 * Adds site_dir/site_scons to sys.path. |
| 348 * Imports site_dir/site_init.py. | 309 * Imports site_dir/site_init.py. |
| 349 * Adds site_dir/site_scons to the SCons tools path. | 310 * Adds site_dir/site_scons to the SCons tools path. |
| 350 """ | 311 """ |
| 351 # Call the same function that SCons does for the --site-dir option. | 312 # Call the same function that SCons does for the --site-dir option. |
| 352 SCons.Script.Main._load_site_scons_dir( | 313 SCons.Script.Main._load_site_scons_dir( |
| 353 SCons.Node.FS.get_default_fs().SConstruct_dir, site_dir) | 314 SCons.Node.FS.get_default_fs().SConstruct_dir, site_dir) |
| 354 | 315 |
| 355 | 316 |
| 356 def AddTargetGroup(target_group, description): | |
| 357 """Adds a target group, used for printing help. | |
| 358 | |
| 359 Args: | |
| 360 target_group: Name of target group. This should be the name of an alias | |
| 361 which points to other aliases for the specific targets. | |
| 362 description: Description of the target group. | |
| 363 """ | |
| 364 | |
| 365 __target_groups[target_group] = description | |
| 366 | |
| 367 #------------------------------------------------------------------------------ | 317 #------------------------------------------------------------------------------ |
| 368 | 318 |
| 369 | 319 |
| 370 _new_options_help = ''' | 320 _new_options_help = ''' |
| 371 Additional options for SCons: | 321 Additional options for SCons: |
| 372 | 322 |
| 373 --mode=MODE Specify build mode (see below). | 323 --mode=MODE Specify build mode (see below). |
| 374 --host-platform=PLATFORM Force SCons to use PLATFORM as the host platform, | 324 --host-platform=PLATFORM Force SCons to use PLATFORM as the host platform, |
| 375 instead of the actual platform on which SCons is | 325 instead of the actual platform on which SCons is |
| 376 run. Useful for examining the dependency tree | 326 run. Useful for examining the dependency tree |
| 377 which would be created, but not useful for | 327 which would be created, but not useful for |
| 378 actually running the build because it'll attempt | 328 actually running the build because it'll attempt |
| 379 to use the wrong tools for your actual platform. | 329 to use the wrong tools for your actual platform. |
| 380 --site-path=DIRLIST Comma-separated list of additional site | 330 --site-path=DIRLIST Comma-separated list of additional site |
| 381 directory paths; each is processed as if passed | 331 directory paths; each is processed as if passed |
| 382 to --site-dir. | 332 to --site-dir. |
| 383 --xml-help Print help in XML format. | |
| 384 ''' | 333 ''' |
| 385 | 334 |
| 386 def SiteInitMain(): | 335 def SiteInitMain(): |
| 387 """Main code executed in site_init.""" | 336 """Main code executed in site_init.""" |
| 388 | 337 |
| 389 # Bail out if we've been here before. This is needed to handle the case where | 338 # Bail out if we've been here before. This is needed to handle the case where |
| 390 # this site_init.py has been dropped into a project directory. | 339 # this site_init.py has been dropped into a project directory. |
| 391 if hasattr(__builtin__, 'BuildEnvironments'): | 340 if hasattr(__builtin__, 'BuildEnvironments'): |
| 392 return | 341 return |
| 393 | 342 |
| 394 # Let people use new global methods directly. | 343 # Let people use new global methods directly. |
| 395 __builtin__.AddSiteDir = AddSiteDir | 344 __builtin__.AddSiteDir = AddSiteDir |
| 396 __builtin__.BuildEnvironments = BuildEnvironments | 345 __builtin__.BuildEnvironments = BuildEnvironments |
| 397 __builtin__.AddTargetGroup = AddTargetGroup | |
| 398 # Legacy method names | 346 # Legacy method names |
| 399 # TODO(rspangler): Remove these once they're no longer used anywhere. | 347 # TODO(rspangler): Remove these once they're no longer used anywhere. |
| 400 __builtin__.BuildComponents = BuildEnvironments | 348 __builtin__.BuildComponents = BuildEnvironments |
| 401 | 349 |
| 402 | 350 |
| 403 # Set list of default tools for component_setup | 351 # Set list of default tools for component_setup |
| 404 __builtin__.component_setup_tools = [ | 352 __builtin__.component_setup_tools = [ |
| 353 # Defer must be first so other tools can register environment |
| 354 # setup/cleanup functions. |
| 355 'defer', |
| 356 # Component_targets must precede component_builders so builders can |
| 357 # define target groups. |
| 358 'component_targets', |
| 405 'command_output', | 359 'command_output', |
| 406 'component_bits', | 360 'component_bits', |
| 407 'component_builders', | 361 'component_builders', |
| 408 'concat_source', | 362 'concat_source', |
| 409 'defer', | |
| 410 'environment_tools', | 363 'environment_tools', |
| 411 'publish', | 364 'publish', |
| 412 'replicate', | 365 'replicate', |
| 413 ] | 366 ] |
| 414 | 367 |
| 415 # Patch Tool._tool_module method to fill in an exists() method for the | 368 # Patch Tool._tool_module method to fill in an exists() method for the |
| 416 # module if it isn't present. | 369 # module if it isn't present. |
| 417 # TODO(sgk): This functionality should be patched into SCons itself by | 370 # TODO(sgk): This functionality should be patched into SCons itself by |
| 418 # changing Tool.__init__(). | 371 # changing Tool.__init__(). |
| 419 SCons.Tool.Tool._tool_module_orig = SCons.Tool.Tool._tool_module | 372 SCons.Tool.Tool._tool_module_orig = SCons.Tool.Tool._tool_module |
| (...skipping 15 matching lines...) Expand all Loading... |
| 435 action='store', | 388 action='store', |
| 436 metavar='PLATFORM', | 389 metavar='PLATFORM', |
| 437 help='build mode(s)') | 390 help='build mode(s)') |
| 438 SCons.Script.AddOption( | 391 SCons.Script.AddOption( |
| 439 '--site-path', | 392 '--site-path', |
| 440 dest='site_path', | 393 dest='site_path', |
| 441 nargs=1, type='string', | 394 nargs=1, type='string', |
| 442 action='store', | 395 action='store', |
| 443 metavar='PATH', | 396 metavar='PATH', |
| 444 help='comma-separated list of site directories') | 397 help='comma-separated list of site directories') |
| 445 SCons.Script.AddOption( | |
| 446 '--xml-help', | |
| 447 dest='xml_help', | |
| 448 action='store_true', | |
| 449 help='print help in XML format') | |
| 450 | 398 |
| 451 if SCons.Script.GetOption('xml_help'): | 399 SCons.Script.Help(_new_options_help) |
| 452 SCons.Script.Help('<?xml version="1.0" encoding="UTF-8" ?>\n<help>\n') | |
| 453 else: | |
| 454 SCons.Script.Help(_new_options_help) | |
| 455 | 400 |
| 456 # Check for site path. This is a list of site directories which each are | 401 # Check for site path. This is a list of site directories which each are |
| 457 # processed as if they were passed to --site-dir. | 402 # processed as if they were passed to --site-dir. |
| 458 site_path = SCons.Script.GetOption('site_path') | 403 site_path = SCons.Script.GetOption('site_path') |
| 459 if site_path: | 404 if site_path: |
| 460 for site_dir in site_path.split(','): | 405 for site_dir in site_path.split(','): |
| 461 AddSiteDir(site_dir) | 406 AddSiteDir(site_dir) |
| 462 | 407 |
| 463 # Since our site dir was specified on the SCons command line, SCons will | 408 # Since our site dir was specified on the SCons command line, SCons will |
| 464 # normally only look at our site dir. Add back checking for project-local | 409 # normally only look at our site dir. Add back checking for project-local |
| 465 # site_scons directories. | 410 # site_scons directories. |
| 466 if not SCons.Script.GetOption('no_site_dir'): | 411 if not SCons.Script.GetOption('no_site_dir'): |
| 467 SCons.Script.Main._load_site_scons_dir( | 412 SCons.Script.Main._load_site_scons_dir( |
| 468 SCons.Node.FS.get_default_fs().SConstruct_dir, None) | 413 SCons.Node.FS.get_default_fs().SConstruct_dir, None) |
| 469 | 414 |
| 470 # Run main code | 415 # Run main code |
| 471 SiteInitMain() | 416 SiteInitMain() |
| OLD | NEW |