diff options
author | anatoly techtonik <techtonik@gmail.com> | 2014-06-01 10:29:01 (GMT) |
---|---|---|
committer | anatoly techtonik <techtonik@gmail.com> | 2014-06-01 10:29:01 (GMT) |
commit | 1c43f7f384bf30f6cce14dc9d3d1e485891c7ddd (patch) | |
tree | 326fbd5c51ddb26d98d799e6b972a21d5a72d2c5 /src | |
parent | 2df3e0774d35b0685523dbbe89549d22d59cdde7 (diff) | |
download | SCons-1c43f7f384bf30f6cce14dc9d3d1e485891c7ddd.zip SCons-1c43f7f384bf30f6cce14dc9d3d1e485891c7ddd.tar.gz SCons-1c43f7f384bf30f6cce14dc9d3d1e485891c7ddd.tar.bz2 |
Speed up SCons execution by creating DefaultEnvironment for
SCons.SConf.CreateConfigHBuilder only if necessary.
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/SCons/SConf.py | 12 | ||||
-rw-r--r-- | src/engine/SCons/Script/Main.py | 6 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/engine/SCons/SConf.py b/src/engine/SCons/SConf.py index 6cc8de8..dd93269 100644 --- a/src/engine/SCons/SConf.py +++ b/src/engine/SCons/SConf.py @@ -119,16 +119,22 @@ def _createConfigH(target, source, env): def _stringConfigH(target, source, env): return "scons: Configure: creating " + str(target[0]) -def CreateConfigHBuilder(env): - """Called just before the building targets phase begins.""" + +def NeedConfigHBuilder(): if len(_ac_config_hs) == 0: - return + return False + else: + return True + +def CreateConfigHBuilder(env): + """Called if necessary just before the building targets phase begins.""" action = SCons.Action.Action(_createConfigH, _stringConfigH) sconfigHBld = SCons.Builder.Builder(action=action) env.Append( BUILDERS={'SConfigHBuilder':sconfigHBld} ) for k in _ac_config_hs.keys(): env.SConfigHBuilder(k, env.Value(_ac_config_hs[k])) + class SConfWarning(SCons.Warnings.Warning): pass diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py index d4dd229..439b869 100644 --- a/src/engine/SCons/Script/Main.py +++ b/src/engine/SCons/Script/Main.py @@ -1031,7 +1031,11 @@ def _main(parser): msg % (deprecated_version_string, python_version_string())) if not options.help: - SCons.SConf.CreateConfigHBuilder(SCons.Defaults.DefaultEnvironment()) + # [ ] Clarify why we need to create Builder here at all, and + # why it is created in DefaultEnvironment + # https://bitbucket.org/scons/scons/commits/d27a548aeee8ad5e67ea75c2d19a7d305f784e30 + if SCons.SConf.NeedConfigHBuilder(): + SCons.SConf.CreateConfigHBuilder(SCons.Defaults.DefaultEnvironment()) # Now re-parse the command-line options (any to the left of a '--' # argument, that is) with any user-defined command-line options that |