assert s == "['n3', 'n2', 'n1']", s
r = repr(nl)
- r = re.sub('at (0x)?[0-9a-z]+', 'at 0x', r)
+ r = re.sub('at (0[xX])?[0-9a-fA-F]+', 'at 0x', r)
# Don't care about ancestry: just leaf value of MyNode
r = re.sub('<.*?\.MyNode', '<MyNode', r)
# New-style classes report as "object"; classic classes report
s = eval(key, self.gvars, lvars)
except AttributeError, e:
raise SCons.Errors.UserError, \
- "Error substituting `%s': unknown attribute `%s'" % (key, e)
+ "Error trying to evaluate `%s': %s" % (s, e)
except (IndexError, NameError, TypeError):
return ''
except SyntaxError,e:
s = eval(key, self.gvars, lvars)
except AttributeError, e:
raise SCons.Errors.UserError, \
- "Error substituting `%s': unknown attribute `%s'" % (key, e)
+ "Error trying to evaluate `%s': %s" % (s, e)
except (IndexError, NameError, TypeError):
return
except SyntaxError,e:
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
+ expect = [
+ "Error trying to evaluate `${foo.bar}': bar",
+ "Error trying to evaluate `${foo.bar}': Foo instance has no attribute 'bar'",
+ ]
+ assert str(e) in expect, e
else:
raise AssertionError, "did not catch expected UserError"
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
+ expect = [
+ "Error trying to evaluate `${foo.bar}': bar",
+ "Error trying to evaluate `${foo.bar}': Foo instance has no attribute 'bar'",
+ ]
+ assert str(e) in expect, e
else:
raise AssertionError, "did not catch expected UserError"
the javac output.
"""
+import os.path
+
import TestSCons
python = TestSCons.python
test.write(['src', 'file2.java'], "file2.java\n/*javac*/\n")
test.write(['src', 'file3.java'], "file3.java\n/*javac*/\n")
+classes_src_file1_class = os.path.join('classes', 'src', 'file1.class')
+src_file1_java= os.path.join('src', 'file1.java')
+src_file2_java= os.path.join('src', 'file2.java')
+src_file3_java= os.path.join('src', 'file3.java')
+
test.run(stdout = test.wrap_stdout("""\
-Compiling class(es) classes/src/file1.class from src/file1.java src/file2.java src/file3.java
-"""))
+Compiling class(es) %(classes_src_file1_class)s from %(src_file1_java)s %(src_file2_java)s %(src_file3_java)s
+""" % locals()))
test.must_match(['classes', 'src', 'file1.class'],
"file1.java\nfile2.java\nfile3.java\n")
print "Could not find `ci' command, skipping test(s)."
test.pass_test(1)
+co = test.where_is('co')
+if not co:
+ print "Could not find `co' command, skipping test(s)."
+ test.pass_test(1)
+
test.subdir('RCS')
stderr = None)
test.write('SConstruct', """
+DefaultEnvironment(RCS_CO = r'%s')
env = Environment()
env.Program('foo.c')
-""")
+""" % co)
test.run(stderr="""\
RCS/foo.c,v --> foo.c
Test various cases where a target is "built" by multiple builder calls.
"""
+import os.path
+import string
+
import TestCmd
import TestSCons
-import os.path
test = TestSCons.TestSCons(match=TestCmd.match_re)
stderr=TestSCons.re_escape("""
scons: warning: Two different environments were specified for target file4.out,
but they appear to have the same action: %(python)s build.py \$foo \$TARGET \$SOURCES
-""" % {'python':TestSCons.python}) + TestSCons.file_expr)
+""" % {'python':string.replace(TestSCons.python, '\\', '\\\\')}) + TestSCons.file_expr)
test.must_match('file4.out', "3\nfile4a.in\nfile4b.in\n")
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
+import os.path
import stat
import sys
import TestSCons
test.run(chdir = 'work3', arguments = 'dir/file', stdout=test.wrap_stdout("""\
pre(["dir"], [])
post(["dir"], [])
-build(["dir/file"], [])
-"""))
+build(["%s"], [])
+""" % os.path.join('dir', 'file')))
test.must_match(['work3', 'dir', 'file'], "build()\n")
### don't seem to work well! ARRGH!!!!
###
-experimenttop = "%s"
+experimenttop = r"%s"
import os
import os.path
#exported_hdrs = generated_hdrs + " " + static_hdrs
exported_hdrs = static_hdrs
lib_name = "g"
-lib_fullname = "libg.a"
+lib_fullname = env.subst("${LIBPREFIX}g${LIBSUFFIX}")
lib_srcs = string.split("libg_1.c libg_2.c libg_3.c")
import re
lib_objs = map(lambda x: re.sub("\.c$", ".o", x), lib_srcs)