+RELEASE 0.95 - XXX
+
+ From Steven Knight:
+
+ - Fix EnsureSConsVersion() so it checks against the SCons version,
+ not the Python version, on Pythons with sys.version_info.
+
+ - Don't swallow the AttributeError when someone uses an expansion like
+ $TARGET.bak, so we can supply a more informative error message.
+
+
+
RELEASE 0.94 - Fri, 07 Nov 2003 05:29:48 -0600
From Hartmut Goebel:
try:
return self.dictSpecialAttrs[name](self)
except KeyError:
- return SCons.Util.Proxy.__getattr__(self, name)
+ try:
+ attr = SCons.Util.Proxy.__getattr__(self, name)
+ except AttributeError:
+ entry = self.get()
+ classname = string.split(str(entry.__class__), '.')[-1]
+ raise AttributeError, "%s instance '%s' has no attribute '%s'" % (classname, entry.name, name)
+ return attr
class Base(SCons.Node.Node):
"""A generic class for file system entries. This class is for
assert f.posix.for_signature() == 'baz.blat_posix', \
f.posix.for_signature()
+ # Check that attempts to access non-existent attributes of the
+ # subst proxy generate the right exceptions and messages.
+ caught = None
+ try:
+ fs.Dir('ddd').get_subst_proxy().no_such_attr
+ except AttributeError, e:
+ assert str(e) == "Dir instance 'ddd' has no attribute 'no_such_attr'", e
+ caught = 1
+ assert caught, "did not catch expected AttributeError"
+
+ caught = None
+ try:
+ fs.Entry('eee').get_subst_proxy().no_such_attr
+ except AttributeError, e:
+ assert str(e) == "Entry instance 'eee' has no attribute 'no_such_attr'", e
+ caught = 1
+ assert caught, "did not catch expected AttributeError"
+
+ caught = None
+ try:
+ fs.File('fff').get_subst_proxy().no_such_attr
+ except AttributeError, e:
+ assert str(e) == "File instance 'fff' has no attribute 'no_such_attr'", e
+ caught = 1
+ assert caught, "did not catch expected AttributeError"
+
fs.BuildDir('foo', 'baz')
assert str(f.srcpath) == os.path.normpath('baz/bar/baz.blat'), str(f.srcpath)
"""Generate a signature for an object
"""
try:
- contents = str(obj.get_contents())
+ gc = obj.get_contents
except AttributeError:
raise AttributeError, "unable to fetch contents of '%s'" % str(obj)
- return hexdigest(md5.new(contents).digest())
+ return hexdigest(md5.new(str(gc())).digest())
def to_string(signature):
"""Convert a signature to a string"""
else:
raise AttributeError, "unexpected get_contents() attribute"
+ # Make sure we don't eat AttributeErrors raised internally
+ # by the get_contents() method (or anything it calls).
+ caught = None
+ try:
+ class xxx:
+ def get_contents(self):
+ raise AttributeError, "internal AttributeError"
+ signature(xxx())
+ except AttributeError, e:
+ assert str(e) == "internal AttributeError", e
+ caught = 1
+ assert caught, "did not catch expected AttributeError"
+
def test_to_string(self):
assert '698d51a19d8a121ce581499d7b701668' == to_string('698d51a19d8a121ce581499d7b701668')