From a343ecc4655243e840f5b0cf62073b0698bd0a60 Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Wed, 15 Apr 2009 10:10:41 +0000 Subject: Per the bug report, this patch improves the "Do not know how to make target X" to say what type of node is being built, and the full path (if it's a file or dir). --- src/engine/SCons/Script/Main.py | 7 ++++++- test/Climb/U-Default-no-target.py | 4 ++-- test/builderrors.py | 10 ++++++++++ test/nonexistent.py | 16 +++++++++------- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py index fb9cbe5..f7ea9c0 100644 --- a/src/engine/SCons/Script/Main.py +++ b/src/engine/SCons/Script/Main.py @@ -207,7 +207,12 @@ class BuildTask(SCons.Taskmaster.OutOfDateTask): t = self.targets[0] if self.top and not t.has_builder() and not t.side_effect: if not t.exists(): - errstr="Do not know how to make target `%s'." % t + def classname(obj): + return string.split(str(obj.__class__), '.')[-1] + if classname(t) in ('File', 'Dir', 'Entry'): + errstr="Do not know how to make %s target `%s' (%s)." % (classname(t), t, t.abspath) + else: # Alias or Python or ... + errstr="Do not know how to make %s target `%s'." % (classname(t), t) sys.stderr.write("scons: *** " + errstr) if not self.options.keep_going: sys.stderr.write(" Stop.") diff --git a/test/Climb/U-Default-no-target.py b/test/Climb/U-Default-no-target.py index b53c295..ca03416 100644 --- a/test/Climb/U-Default-no-target.py +++ b/test/Climb/U-Default-no-target.py @@ -37,8 +37,8 @@ test.write('SConstruct', """ Default('not_a_target.in') """) -test.run(arguments = '-U', status=2, stderr="""\ -scons: *** Do not know how to make target `not_a_target.in'. Stop. +test.run(arguments = '-U', status=2, match=TestSCons.match_re, stderr="""\ +scons: \*\*\* Do not know how to make File target `not_a_target.in' \(.*not_a_target.in\). Stop. """) test.pass_test() diff --git a/test/builderrors.py b/test/builderrors.py index 72b856f..e5d8866 100644 --- a/test/builderrors.py +++ b/test/builderrors.py @@ -201,6 +201,16 @@ test.run(status=2, stderr=None) test.must_not_contain_any_line(test.stderr(), ['Exception', 'Traceback']) +# Bug #1053: Alias is called "all", but default is the File "all" +test.write('SConstruct', """ +env = Environment() +env.Default("all") +env.Alias("all", env.Install("dir", "file.txt")) +""") +test.run(status=2, match=TestSCons.match_re, stderr="""\ +scons: \*\*\* Do not know how to make File target `all' \(.*all\). Stop. +""") + # No tests failed; OK. test.pass_test() diff --git a/test/nonexistent.py b/test/nonexistent.py index 0a6947c..770f3b7 100644 --- a/test/nonexistent.py +++ b/test/nonexistent.py @@ -46,13 +46,14 @@ Dir('ddd') """) test.run(arguments = 'foo', - stderr = "scons: \\*\\*\\* Do not know how to make target `foo'.( *Stop.)?\n", + stderr = "scons: \\*\\*\\* Do not know how to make File target `foo' \\(.*foo\\).( *Stop.)?\n", status = 2, match=TestSCons.match_re_dotall) test.run(arguments = '-k foo/bar foo', - stderr = "scons: *** Do not know how to make target `%s'.\n" % foo_bar, - status = 2) + stderr = "scons: \\*\\*\\* Do not know how to make File target `%s' \\(.*foo.bar\\).\n" % foo_bar, + status = 2, + match=TestSCons.match_re_dotall) test.run(arguments = "aaa.out", stderr = "scons: *** [aaa.out] Source `aaa.in' not found, needed by target `aaa.out'.\n", @@ -65,14 +66,15 @@ scons: *** [aaa.out] Source `aaa.in' not found, needed by target `aaa.out'. status = 2) test.run(arguments = '-k aaa.in bbb.in', - stderr = """scons: *** Do not know how to make target `aaa.in'. -scons: *** Do not know how to make target `bbb.in'. + stderr = """scons: \\*\\*\\* Do not know how to make File target `aaa.in' \\(.*aaa.in\\). +scons: \\*\\*\\* Do not know how to make File target `bbb.in' \\(.*bbb.in\\). """, - status = 2) + status = 2, + match=TestSCons.match_re_dotall) test.run(arguments = 'xxx', - stderr = "scons: \\*\\*\\* Do not know how to make target `xxx'.( *Stop.)?\n", + stderr = "scons: \\*\\*\\* Do not know how to make File target `xxx' \\(.*xxx\\).( *Stop.)?\n", status = 2, match=TestSCons.match_re_dotall) -- cgit v0.12