summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Script
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2006-02-25 18:18:55 (GMT)
committerSteven Knight <knight@baldmt.com>2006-02-25 18:18:55 (GMT)
commitc32fd05c5b00b7658c8459c54bb7df37fd890284 (patch)
tree4c3768750f3780254d151018eeeba54faaedf1d9 /src/engine/SCons/Script
parent40bbc04d482ed19b5ae7593acb4b5afaa76520c3 (diff)
downloadSCons-c32fd05c5b00b7658c8459c54bb7df37fd890284.zip
SCons-c32fd05c5b00b7658c8459c54bb7df37fd890284.tar.gz
SCons-c32fd05c5b00b7658c8459c54bb7df37fd890284.tar.bz2
In the error message, supply the file name that triggered on IOError or OSError, not just the target name.
Diffstat (limited to 'src/engine/SCons/Script')
-rw-r--r--src/engine/SCons/Script/Main.py27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py
index 6074708..73f96e2 100644
--- a/src/engine/SCons/Script/Main.py
+++ b/src/engine/SCons/Script/Main.py
@@ -138,16 +138,29 @@ class BuildTask(SCons.Taskmaster.Task):
# see if the sys module has one.
t, e = sys.exc_info()[:2]
+ def nodestring(n):
+ if not SCons.Util.is_List(n):
+ n = [ n ]
+ return string.join(map(str, n), ', ')
+
+ errfmt = "scons: *** [%s] %s\n"
+
if t == SCons.Errors.BuildError:
- fname = e.node
- if SCons.Util.is_List(e.node):
- fname = string.join(map(str, e.node), ', ')
- sys.stderr.write("scons: *** [%s] %s\n" % (fname, e.errstr))
- if e.errstr == 'Exception':
- traceback.print_exception(e.args[0], e.args[1], e.args[2])
+ tname = nodestring(e.node)
+ errstr = e.errstr
+ if e.filename:
+ errstr = e.filename + ': ' + errstr
+ sys.stderr.write(errfmt % (tname, errstr))
+ elif t == SCons.Errors.TaskmasterException:
+ tname = nodestring(e.node)
+ sys.stderr.write(errfmt % (tname, e.errstr))
+ type, value, trace = e.exc_info
+ traceback.print_exception(type, value, trace)
elif t == SCons.Errors.ExplicitExit:
status = e.status
- sys.stderr.write("scons: *** [%s] Explicit exit, status %s\n" % (e.node, e.status))
+ tname = nodestring(e.node)
+ errstr = 'Explicit exit, status %s' % status
+ sys.stderr.write(errfmt % (tname, errstr))
else:
if e is None:
e = t