From: stevenknight Date: Thu, 2 May 2002 18:32:06 +0000 (+0000) Subject: Fix a bug that caused BuildDir(duplicate=1) along with passing a Node to SConscript... X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=907cecb1123f0c367a23591e5b2203496178bef2;p=scons.git Fix a bug that caused BuildDir(duplicate=1) along with passing a Node to SConscript() to act as if BuildDir() wasn't used. git-svn-id: http://scons.tigris.org/svn/scons/trunk@359 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/CHANGES.txt b/src/CHANGES.txt index caaaf3e4..3dc11daa 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -150,6 +150,8 @@ RELEASE 0.07 - Thu, 25 Apr 2002 06:24:50 -0500 - Fix for using Aliases with the -u, -U and -D options. + - Fix so that Nodes can be passed to SConscript files. + From Moshe Zadka: - Changes for official Debian packaging. diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py index 79e2a607..606be08f 100644 --- a/src/engine/SCons/Script/SConscript.py +++ b/src/engine/SCons/Script/SConscript.py @@ -158,7 +158,10 @@ def SConscript(*ls, **kw): if fn == "-": exec sys.stdin in stack[-1].globals else: - f = SCons.Node.FS.default_fs.File(str(fn)) + if isinstance(fn, SCons.Node.Node): + f = fn + else: + f = SCons.Node.FS.default_fs.File(str(fn)) if f.exists(): file = open(str(f), "r") SCons.Node.FS.default_fs.chdir(f.dir) diff --git a/test/BuildDir.py b/test/BuildDir.py index 893731cb..4b835a6b 100644 --- a/test/BuildDir.py +++ b/test/BuildDir.py @@ -42,15 +42,20 @@ foo21 = test.workpath('build', 'var2', 'foo1' + _exe) foo22 = test.workpath('build', 'var2', 'foo2' + _exe) foo31 = test.workpath('build', 'var3', 'foo1' + _exe) foo32 = test.workpath('build', 'var3', 'foo2' + _exe) +foo41 = test.workpath('build', 'var4', 'foo1' + _exe) +foo42 = test.workpath('build', 'var4', 'foo2' + _exe) test.write('SConstruct', """ src = Dir('src') var2 = Dir('build/var2') var3 = Dir('build/var3') +var4 = Dir('build/var4') + BuildDir('build/var1', src) BuildDir(var2, src) BuildDir(var3, src, duplicate=0) +BuildDir(var4, src, duplicate=0) env = Environment(CPPPATH='#src') SConscript('build/var1/SConscript', "env") @@ -58,6 +63,8 @@ SConscript('build/var2/SConscript', "env") env = Environment(CPPPATH=src) SConscript('build/var3/SConscript', "env") +SConscript(File('SConscript', var4), "env") + """) test.subdir('src') @@ -120,9 +127,16 @@ test.run(program = foo21, stdout = "f1.c\n") test.run(program = foo22, stdout = "f2.c\n") test.run(program = foo31, stdout = "f1.c\n") test.run(program = foo32, stdout = "f2.c\n") +test.run(program = foo41, stdout = "f1.c\n") +test.run(program = foo42, stdout = "f2.c\n") # Make sure we didn't duplicate the source files in build/var3. test.fail_test(os.path.exists(test.workpath('build', 'var3', 'f1.c'))) test.fail_test(os.path.exists(test.workpath('build', 'var3', 'f2.in'))) +# Make sure we didn't duplicate the source files in build/var3. +test.fail_test(os.path.exists(test.workpath('build', 'var4', 'f1.c'))) +test.fail_test(os.path.exists(test.workpath('build', 'var4', 'f2.in'))) + + test.pass_test()