will add to the (now empty) default-target list
like normal.
+.TP
+.RI DefaultEnvironment()
+Creates and returns a default construction environment object.
+This construction environment is used internally by SCons
+in order to fetch source files transparently
+from source code management systems.
+
.TP
.RI Dir( name ", [" directory ])
This returns an object that represents a given directory
- Give a Value Nodes a timestamp of the system time when they're
created, so they'll work when using timestamp-based signatures.
+ - Add a DefaultEnvironment() function that only creates a default
+ environment on-demand (for fetching source files, e.g.).
+
From Steven Knight:
- Tighten up the scons -H help output.
import SCons.Action
import SCons.Builder
+import SCons.Environment
import SCons.Node.Alias
import SCons.Node.FS
import SCons.Scanner.C
# interface.
_default_env = None
+# Lazily instantiate the default environment so the overhead of creating
+# it doesn't apply when it's not needed.
+def DefaultEnvironment():
+ global _default_env
+ if not _default_env:
+ _default_env = SCons.Environment.Environment()
+ return _default_env
+
+
def alias_builder(env, target, source):
pass
import SCons.Builder
import SCons.Defaults
DefaultSCCSBuilder = SCons.Builder.Builder(action = '$SCCSCOM',
- env = SCons.Defaults._default_env)
+ env = SCons.Defaults.DefaultEnvironment())
return DefaultSCCSBuilder
def get_DefaultRCSBuilder():
import SCons.Builder
import SCons.Defaults
DefaultRCSBuilder = SCons.Builder.Builder(action = '$RCS_COCOM',
- env = SCons.Defaults._default_env)
+ env = SCons.Defaults.DefaultEnvironment())
return DefaultRCSBuilder
#
"""
globals = {}
- globals['_default_env'] = SCons.Defaults._default_env
globals['Action'] = SCons.Action.Action
globals['AddPostAction'] = AddPostAction
globals['AddPreAction'] = AddPreAction
globals['Configure'] = SCons.SConf.SConf
globals['CScan'] = SCons.Defaults.CScan
globals['Default'] = Default
+ globals['DefaultEnvironment'] = SCons.Defaults.DefaultEnvironment
globals['Dir'] = SCons.Node.FS.default_fs.Dir
globals['EnsurePythonVersion'] = EnsurePythonVersion
globals['EnsureSConsVersion'] = EnsureSConsVersion
SCons.Node.FS.default_fs.set_toplevel_dir(os.getcwd())
- # Now that the top-level directory has been set,
- # we can initialize the default Environment.
- SCons.Defaults._default_env = SCons.Environment.Environment()
-
scripts = []
if options.file:
scripts.extend(options.file)
for src in source:
f.write(open(src, "rb").read())
f.close()
-_default_env['SCCS'] = r'%s'
+DefaultEnvironment()['SCCS'] = r'%s'
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
env.Cat('aaa.out', 'aaa.in')
env.Cat('bbb.out', 'bbb.in')
for src in source:
f.write(open(src, "rb").read())
f.close()
-_default_env['RCS_COFLAGS'] = '-l'
+DefaultEnvironment()['RCS_COFLAGS'] = '-l'
env = Environment(ENV=ENV, BUILDERS={'Cat':Builder(action=cat)})
env.Cat('aaa.out', 'aaa.in')
env.Cat('bbb.out', 'bbb.in')