summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2005-12-01 20:57:48 (GMT)
committerSteven Knight <knight@baldmt.com>2005-12-01 20:57:48 (GMT)
commit6936ce13e719f5a5b548518344702837765f80f6 (patch)
tree789ba537fabde1ff80035244575f587e03754215 /src
parent3da5aafb7ef2a807426a77ff0893070fad904319 (diff)
downloadSCons-6936ce13e719f5a5b548518344702837765f80f6.zip
SCons-6936ce13e719f5a5b548518344702837765f80f6.tar.gz
SCons-6936ce13e719f5a5b548518344702837765f80f6.tar.bz2
Handle interpretation of Node.FS objects when wrapped in Proxy instances. (Erling Andersen)
Diffstat (limited to 'src')
-rw-r--r--src/CHANGES.txt5
-rw-r--r--src/engine/SCons/Node/FS.py8
-rw-r--r--src/engine/SCons/Node/FSTests.py14
3 files changed, 27 insertions, 0 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 3c3ab20..0833bf8 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -20,6 +20,11 @@ RELEASE 0.97 - XXX
- Fix the intelc.py Tool module to not throw an exception if the
only installed version is something other than ia32.
+ From Erling Andersen:
+
+ - Fix interpretation of Node.FS objects wrapped in Proxy instances,
+ allowing expansion of things like ${File(TARGET)} in command lines.
+
From Chad Austin:
- Allow Help() to be called multiple times, appending to the help
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py
index 7d4d8df..7f45751 100644
--- a/src/engine/SCons/Node/FS.py
+++ b/src/engine/SCons/Node/FS.py
@@ -993,6 +993,14 @@ class FS(LocalFS):
If directory is None, and name is a relative path,
then the same applies.
"""
+ if not SCons.Util.is_String(name):
+ # This handles cases where the object is a Proxy wrapping
+ # a Node.FS.File object (e.g.). It would be good to handle
+ # this more directly some day by having the callers of this
+ # function recognize that a Proxy can be treated like the
+ # underlying object (that is, get rid of the isinstance()
+ # calls that explicitly look for a Node.FS.Base object).
+ name = str(name)
if name and name[0] == '#':
directory = self.Top
name = name[1:]
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py
index cb98f50..6514375 100644
--- a/src/engine/SCons/Node/FSTests.py
+++ b/src/engine/SCons/Node/FSTests.py
@@ -1435,6 +1435,20 @@ class FSTestCase(_tempdirTestCase):
failed = failed + 1
assert failed == 0, "%d rel_path() cases failed" % failed
+ def test_proxy(self):
+ """Test a Node.FS object wrapped in a proxy instance"""
+ f1 = self.fs.File('fff')
+ class Proxy:
+ # Simplest possibly Proxy class that works for our test,
+ # this is stripped down from SCons.Util.Proxy.
+ def __init__(self, subject):
+ self.__subject = subject
+ def __getattr__(self, name):
+ return getattr(self.__subject, name)
+ p = Proxy(f1)
+ f2 = self.fs.Entry(p)
+ assert f1 is f2, (f1, f2)
+
class DirTestCase(_tempdirTestCase):
def test__morph(self):