- Fix the private Conftest._Have() function so it doesn't change
non-alphanumeric characters to underscores.
+ - Supply a better error message when a construction variable expansion
+ has an unknown attribute.
+
From Chris Pawling:
- Have the linkloc tool use $MSVS_VERSION to select the Microsoft
key = key[1:-1]
try:
s = eval(key, self.gvars, lvars)
+ except AttributeError, e:
+ raise SCons.Errors.UserError, \
+ "Error substituting `%s': unknown attribute `%s'" % (key, e)
except (IndexError, NameError, TypeError):
return ''
except SyntaxError,e:
key = key[1:-1]
try:
s = eval(key, self.gvars, lvars)
+ except AttributeError, e:
+ raise SCons.Errors.UserError, \
+ "Error substituting `%s': unknown attribute `%s'" % (key, e)
except (IndexError, NameError, TypeError):
return
except SyntaxError,e:
gvars=gvars)
assert newcom == "test foo baz s t", newcom
+ # Test that we handle attribute errors during expansion as expected.
+ try:
+ class Foo:
+ pass
+ scons_subst('${foo.bar}', env, gvars={'foo':Foo()})
+ except SCons.Errors.UserError, e:
+ expect = "Error substituting `foo.bar': unknown attribute `bar'"
+ assert str(e) == expect, e
+ else:
+ raise AssertionError, "did not catch expected UserError"
+
# Test that we handle syntax errors during expansion as expected.
try:
scons_subst('$foo.bar.3.0', env)
del subst_list_cases[:4]
assert failed == 0, "%d subst() mode cases failed" % failed
+ # Test that we handle attribute errors during expansion as expected.
+ try:
+ class Foo:
+ pass
+ scons_subst_list('${foo.bar}', env, gvars={'foo':Foo()})
+ except SCons.Errors.UserError, e:
+ expect = "Error substituting `foo.bar': unknown attribute `bar'"
+ assert str(e) == expect, e
+ else:
+ raise AssertionError, "did not catch expected UserError"
+
# Test that we handle syntax errors during expansion as expected.
try:
scons_subst_list('$foo.bar.3.0', env)