diff options
author | Gary Oberbrunner <garyo@oberbrunner.com> | 2010-07-31 19:34:57 (GMT) |
---|---|---|
committer | Gary Oberbrunner <garyo@oberbrunner.com> | 2010-07-31 19:34:57 (GMT) |
commit | c486acc05402e4e9644d06030bc4263bfcb4f6d1 (patch) | |
tree | ee23c59ea2e8f5c1a6d47c13b2f38a3d3ba93c6e /src/engine/SCons/Node | |
parent | f90428a47102789f1c5cd902651c72e41ac6b0d8 (diff) | |
download | SCons-c486acc05402e4e9644d06030bc4263bfcb4f6d1.zip SCons-c486acc05402e4e9644d06030bc4263bfcb4f6d1.tar.gz SCons-c486acc05402e4e9644d06030bc4263bfcb4f6d1.tar.bz2 |
Fix issue 2048: when morphing an Entry into a Dir, retain any existing executor action list.
Diffstat (limited to 'src/engine/SCons/Node')
-rw-r--r-- | src/engine/SCons/Node/FS.py | 21 | ||||
-rw-r--r-- | src/engine/SCons/Node/FSTests.py | 4 |
2 files changed, 20 insertions, 5 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 4aeaff7..967da26 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -1083,7 +1083,10 @@ class FS(LocalFS): self.max_drift = max_drift def getcwd(self): - return self._cwd + if hasattr(self, "_cwd"): + return self._cwd + else: + return "<no cwd>" def chdir(self, dir, change_os_dir=0): """Change the current working directory for lookups. @@ -1353,8 +1356,20 @@ class Dir(Base): # Don't just reset the executor, replace its action list, # because it might have some pre-or post-actions that need to # be preserved. - self.builder = get_MkdirBuilder() - self.get_executor().set_action_list(self.builder.action) + # + # But don't reset the executor if there is a non-null executor + # attached already. The existing executor might have other + # targets, in which case replacing the action list with a + # Mkdir action is a big mistake. + if not hasattr(self, 'executor'): + self.builder = get_MkdirBuilder() + self.get_executor().set_action_list(self.builder.action) + else: + # Prepend MkdirBuilder action to existing action list + l = self.get_executor().action_list + a = get_MkdirBuilder().action + l.insert(0, a) + self.get_executor().set_action_list(l) def diskcheck_match(self): diskcheck_match(self, self.isfile, diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index 9a393e2..b5c1448 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -1676,8 +1676,8 @@ class DirTestCase(_tempdirTestCase): x.add_post_action('post') e.must_be_same(SCons.Node.FS.Dir) a = x.get_action_list() - assert a[0] == 'pre', a - assert a[2] == 'post', a + assert 'pre' in a, a + assert 'post' in a, a def test_subclass(self): """Test looking up subclass of Dir nodes""" |