From: stevenknight Date: Tue, 19 Aug 2003 23:06:05 +0000 (+0000) Subject: Portability fixes for tests. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=97aa41b1edbcaecb51547f27f70c602f63c70e28;p=scons.git Portability fixes for tests. git-svn-id: http://scons.tigris.org/svn/scons/trunk@773 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/doc/man/scons.1 b/doc/man/scons.1 index aaf6c0ff..640dc670 100644 --- a/doc/man/scons.1 +++ b/doc/man/scons.1 @@ -4359,7 +4359,7 @@ will add to the (now empty) default-target list 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 diff --git a/src/CHANGES.txt b/src/CHANGES.txt index a990f934..8b5e2663 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -18,6 +18,9 @@ RELEASE X.XX - XXX, XX XXX XXXX XX:XX:XX XXXXX - 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 diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py index 5ade3e0b..66e8b008 100644 --- a/src/engine/SCons/Defaults.py +++ b/src/engine/SCons/Defaults.py @@ -60,10 +60,10 @@ _default_env = None # 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 diff --git a/test/BitKeeper.py b/test/BitKeeper.py index 3374f92a..4d703ab6 100644 --- a/test/BitKeeper.py +++ b/test/BitKeeper.py @@ -46,7 +46,7 @@ def is_writable(file): try: login = os.getlogin() -except AttributeError: +except (AttributeError, OSError): try: login = os.environ['USER'] except KeyError: @@ -298,7 +298,7 @@ def cat(env, source, target): 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') diff --git a/test/ToolSurrogate.py b/test/ToolSurrogate.py index f33d8048..dc190dd0 100644 --- a/test/ToolSurrogate.py +++ b/test/ToolSurrogate.py @@ -80,22 +80,22 @@ ToolList = { 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()