diff options
| author | Steven Knight <knight@baldmt.com> | 2004-10-21 12:07:26 (GMT) |
|---|---|---|
| committer | Steven Knight <knight@baldmt.com> | 2004-10-21 12:07:26 (GMT) |
| commit | c9c69b3bd0dd817e589efcc83643e45071d2a95c (patch) | |
| tree | 803f5bc5122b2a22d15f8375bab9361164487a6c /src/engine | |
| parent | 3e52ca38ff11bf7515dbeb05af362f370479bfb4 (diff) | |
| download | SCons-c9c69b3bd0dd817e589efcc83643e45071d2a95c.zip SCons-c9c69b3bd0dd817e589efcc83643e45071d2a95c.tar.gz SCons-c9c69b3bd0dd817e589efcc83643e45071d2a95c.tar.bz2 | |
Handle use of Mkdir() when the file exists.
Diffstat (limited to 'src/engine')
| -rw-r--r-- | src/engine/SCons/Node/FS.py | 9 | ||||
| -rw-r--r-- | src/engine/SCons/Node/FSTests.py | 7 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 883b82c..1e24be0 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -1507,7 +1507,7 @@ class File(Base): return includes - def _createDir(self): + def _createDir(self, update=None): # ensure that the directories for this node are # created. @@ -1529,6 +1529,11 @@ class File(Base): # directory. The dirnode.build() method will suppress # the build if it's the default builder. SCons.Node.Node.build(dirnode) + if update: + # Mark this directory as built so we don't try to build + # it again if it has an explicit user-defined Builder. + dirnode.set_state(SCons.Node.executed) + dirnode.built() # The build() action may or may not have actually # created the directory, depending on whether the -n # option was used or not. Delete the _exists and @@ -1667,7 +1672,7 @@ class File(Base): pass else: try: - self._createDir() + self._createDir(update=1) except SCons.Errors.StopError, drive: desc = "No drive `%s' for target `%s'." % (drive, self) raise SCons.Errors.StopError, desc diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index 2259b7b..67c4ffe 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -1504,7 +1504,7 @@ class prepareTestCase(unittest.TestCase): """Test the prepare() method""" class MyFile(SCons.Node.FS.File): - def _createDir(self): + def _createDir(self, update=None): raise SCons.Errors.StopError def exists(self): return None @@ -1533,9 +1533,14 @@ class prepareTestCase(unittest.TestCase): xyz.set_state(SCons.Node.up_to_date) xyz.prepare() assert dir_made == [], dir_made + state = new_dir.get_state() + assert state != SCons.Node.executed, state + xyz.set_state(0) xyz.prepare() assert dir_made[0].path == "new_dir", dir_made[0] + state = new_dir.get_state() + assert state == SCons.Node.executed, state dir = fs.Dir("dir") dir.prepare() |
