diff options
| author | Steven Knight <knight@baldmt.com> | 2003-12-06 14:22:09 (GMT) |
|---|---|---|
| committer | Steven Knight <knight@baldmt.com> | 2003-12-06 14:22:09 (GMT) |
| commit | 13bb2c1410f48a1ca114359534e84561e18a6dad (patch) | |
| tree | 4be410d43ec7a9e9b5328e978ee1bd8d9128306c /src/engine | |
| parent | 42ee4d4c6c6e24483c86f7b70a51348ca13d23d7 (diff) | |
| download | SCons-13bb2c1410f48a1ca114359534e84561e18a6dad.zip SCons-13bb2c1410f48a1ca114359534e84561e18a6dad.tar.gz SCons-13bb2c1410f48a1ca114359534e84561e18a6dad.tar.bz2 | |
Preserve the ability to call BuildDir() multiple times with the same source and target dirs. (Charles Crain)
Diffstat (limited to 'src/engine')
| -rw-r--r-- | src/engine/SCons/Node/FS.py | 2 | ||||
| -rw-r--r-- | src/engine/SCons/Node/FSTests.py | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 9a4fb97..45809f9 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -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) diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index cbda758..fcd605b 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -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')) |
