From: stevenknight Date: Wed, 12 Nov 2003 15:14:47 +0000 (+0000) Subject: Make duplicate build dir specifications be an error. (Anthony Roach) X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d0f4841fa36b899e032d44b8f1edf44b37d577a8;p=scons.git Make duplicate build dir specifications be an error. (Anthony Roach) git-svn-id: http://scons.tigris.org/svn/scons/trunk@846 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/CHANGES.txt b/src/CHANGES.txt index f48c5876..d4fb5323 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -1,4 +1,4 @@ -# __COPYRIGHT__ +r __COPYRIGHT__ # __FILE__ __REVISION__ __DATE__ __DEVELOPER__ @@ -37,6 +37,11 @@ RELEASE 0.95 - XXX - Allow the LIBS construction variable to be a single string or File node, not a list, when only one library is needed. + From Anthony Roach: + + - Supply an error message if the user tries to configure a BuildDir + for a directory that already has one. + RELEASE 0.94 - Fri, 07 Nov 2003 05:29:48 -0600 diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index e7ab14a3..9a4fb976 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -792,6 +792,8 @@ class FS: raise SCons.Errors.UserError, "Source directory must be under top of build tree." if src_dir.is_under(build_dir): raise SCons.Errors.UserError, "Source directory cannot be under build directory." + if build_dir.srcdir: + raise SCons.Errors.UserError, "'%s' already has a source directory: '%s'."%(build_dir, build_dir.srcdir) build_dir.link(src_dir, duplicate) def Repository(self, *dirs): diff --git a/test/BuildDir-errors.py b/test/BuildDir-errors.py index ead50569..4941a645 100644 --- a/test/BuildDir-errors.py +++ b/test/BuildDir-errors.py @@ -151,5 +151,22 @@ scons: internal stack trace: f.close() -# +# ensure that specifying multiple source directories for one +# build directory results in an error message, rather +# than just silently failing. +test.subdir('duplicate', ['duplicate', 'src1'], ['duplicate', 'src2']) +test.write(['duplicate', 'SConstruct'], """\ +BuildDir('build', 'src1') +BuildDir('build', 'src2') +""") + +test.run(chdir = 'duplicate', + arguments = ".", + status = 2, + stderr = None) +test.fail_test(test.stderr() != """ +scons: *** 'build' already has a source directory: 'src1'. +File \"SConstruct\", line 2, in ? +""") + test.pass_test()