like normal.
.TP
-.RI DefaultEnvironment()
+.RI DefaultEnvironment([ args ])
Creates and returns a default construction environment object.
This construction environment is used internally by SCons
in order to fetch source files transparently
- Refactor the DictCmdGenerator class to be a Selector subclass.
+ - Allow the DefaultEnvironment() function to take arguments and pass
+ them to instantiation of the default construction environment.
+
From Gerard Patel
- When the yacc -d flag is used, take the .h file base name from the
# Lazily instantiate the default environment so the overhead of creating
# it doesn't apply when it's not needed.
-def DefaultEnvironment():
+def DefaultEnvironment(*args, **kw):
global _default_env
if not _default_env:
- _default_env = SCons.Environment.Environment()
+ _default_env = apply(SCons.Environment.Environment, args, kw)
return _default_env
try:
login = os.getlogin()
-except AttributeError:
+except (AttributeError, OSError):
try:
login = os.environ['USER']
except KeyError:
for src in source:
f.write(open(src, "rb").read())
f.close()
-DefaultEnvironment()['SCCS'] = r'%s'
+DefaultEnvironment(tools=['SCCS'])['SCCS'] = r'%s'
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
env.Cat('aaa.out', 'aaa.in')
env.Cat('bbb.out', 'bbb.in')
platform = ARGUMENTS['platform']
tools = map(lambda t: apply(ToolSurrogate, t), ToolList[platform])
-env = Environment(tools = tools)
+env = Environment(tools=tools, PROGSUFFIX='.exe', OBJSUFFIX='.obj')
env.Program('foo.c')
""")
test.write('foo.c', "foo.c posix\n")
test.run(arguments = '. platform=posix', stdout = test.wrap_stdout("""\
-cc -c -o foo.o foo.c
-c++ -o foo foo.o
+cc -c -o foo.obj foo.c
+c++ -o foo.exe foo.obj
"""))
test.write('foo.c', "foo.c win32\n")
test.run(arguments = '. platform=win32', stdout = test.wrap_stdout("""\
-cl /nologo /c foo.c /Fofoo.o
-link /nologo /OUT:foo foo.o
+cl /nologo /c foo.c /Fofoo.obj
+link /nologo /OUT:foo.exe foo.obj
"""))
test.pass_test()