summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGary Oberbrunner <garyo@oberbrunner.com>2010-07-31 19:34:57 (GMT)
committerGary Oberbrunner <garyo@oberbrunner.com>2010-07-31 19:34:57 (GMT)
commitc486acc05402e4e9644d06030bc4263bfcb4f6d1 (patch)
treeee23c59ea2e8f5c1a6d47c13b2f38a3d3ba93c6e
parentf90428a47102789f1c5cd902651c72e41ac6b0d8 (diff)
downloadSCons-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.
-rw-r--r--src/CHANGES.txt4
-rw-r--r--src/engine/SCons/Node/FS.py21
-rw-r--r--src/engine/SCons/Node/FSTests.py4
3 files changed, 24 insertions, 5 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index ddc70cf..cf28f38 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -7,6 +7,10 @@
RELEASE 2.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE
+ From Ken Deeter:
+
+ - Fix a problem when FS Entries which are actually Dirs have builders.
+
From Luca Falavigna:
- Support Fortran 03
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"""