Preserve the ability to call BuildDir() multiple times with the same source and targe...
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 6 Dec 2003 14:22:09 +0000 (14:22 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 6 Dec 2003 14:22:09 +0000 (14:22 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@857 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/Node/FS.py
src/engine/SCons/Node/FSTests.py

index b95cfc03b10d68602658f9661e8abe3bf71e86fb..9baeba330f4cbfc14673ea6d178b0135a1b5c674 100644 (file)
@@ -46,6 +46,9 @@ RELEASE 0.95 - XXX
   - Make sure side-effect nodes are prepare()d before building their
     corresponding target.
 
+  - Preserve the ability to call BuildDir() multiple times with the
+    same target and source directory arguments.
+
   From Scott Lystig Fritchie:
 
   - Fix the ability to use a custom _concat() function in the
index 9a4fb9760c887f767f3e3aef864def7d72082997..45809f90536fd535bf76350023271f0853c07aaf 100644 (file)
@@ -793,6 +793,8 @@ class FS:
         if src_dir.is_under(build_dir):
             raise SCons.Errors.UserError, "Source directory cannot be under build directory."
         if build_dir.srcdir:
+            if build_dir.srcdir == src_dir:
+                return # We already did this.
             raise SCons.Errors.UserError, "'%s' already has a source directory: '%s'."%(build_dir, build_dir.srcdir)
         build_dir.link(src_dir, duplicate)
 
index cbda75837eaeab14b75d763e6d6cb2a5d3a5ee87..fcd605b43ed94569d195ae152a991b9ab64c2869 100644 (file)
@@ -384,6 +384,21 @@ class BuildDirTestCase(unittest.TestCase):
             test.unlink( "src/foo" )
             test.unlink( "build/foo" )
 
+        fs = SCons.Node.FS.FS()
+        fs.BuildDir('build', 'src1')
+
+        # Calling the same BuildDir twice should work fine.
+        fs.BuildDir('build', 'src1')
+
+        # Trying to move a build dir to a second source dir
+        # should blow up
+        try:
+            fs.BuildDir('build', 'src2')
+        except SCons.Errors.UserError:
+            pass
+        else:
+            assert 0, "Should have caught a UserError."
+
         # Test against a former bug.  Make sure we can get a repository
         # path for the build directory itself!
         fs=SCons.Node.FS.FS(test.workpath('work'))