summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Util.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-05-23 12:13:44 (GMT)
committerSteven Knight <knight@baldmt.com>2004-05-23 12:13:44 (GMT)
commita42bf7218937b6c8c3c6efe95d5ee4529ea9bd32 (patch)
tree2c78912009c9c6cb2159523d8e8f0f3f36d5a2cf /src/engine/SCons/Util.py
parentdfab5d29d8260f779e9c3d3363a81fd68d5498a5 (diff)
downloadSCons-a42bf7218937b6c8c3c6efe95d5ee4529ea9bd32.zip
SCons-a42bf7218937b6c8c3c6efe95d5ee4529ea9bd32.tar.gz
SCons-a42bf7218937b6c8c3c6efe95d5ee4529ea9bd32.tar.bz2
Better handling of syntax errors during variable expansion. (Anthony Roach)
Diffstat (limited to 'src/engine/SCons/Util.py')
-rw-r--r--src/engine/SCons/Util.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py
index d2e1d73..8b7207c 100644
--- a/src/engine/SCons/Util.py
+++ b/src/engine/SCons/Util.py
@@ -552,8 +552,11 @@ def scons_subst(strSubst, env, mode=SUBST_RAW, target=None, source=None, dict=No
s = eval(key, self.gvars, lvars)
except (IndexError, NameError, TypeError):
return ''
- except (SyntaxError):
- raise SCons.Errors.UserError, "Syntax error trying to evaluate `%s'" % s
+ except SyntaxError,e:
+ if self.target:
+ raise SCons.Errors.BuildError, (self.target[0], "Syntax error `%s' trying to evaluate `%s'" % (e,s))
+ else:
+ raise SCons.Errors.UserError, "Syntax error `%s' trying to evaluate `%s'" % (e,s)
else:
# Before re-expanding the result, handle
# recursive expansion by copying the local
@@ -695,8 +698,11 @@ def scons_subst_list(strSubst, env, mode=SUBST_RAW, target=None, source=None, di
s = eval(key, self.gvars, lvars)
except (IndexError, NameError, TypeError):
return
- except (SyntaxError):
- raise SCons.Errors.UserError, "Syntax error trying to evaluate `%s'" % s
+ except SyntaxError,e:
+ if self.target:
+ raise SCons.Errors.BuildError, (self.target[0], "Syntax error `%s' trying to evaluate `%s'" % (e,s))
+ else:
+ raise SCons.Errors.UserError, "Syntax error `%s' trying to evaluate `%s'" % (e,s)
else:
# Before re-expanding the result, handle
# recursive expansion by copying the local