diff options
author | David Cournapeau <cournape@gmail.com> | 2009-11-19 04:59:58 (GMT) |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2009-11-19 04:59:58 (GMT) |
commit | 36c827ec59dca401b20c3bef478b04da738e13f1 (patch) | |
tree | 8caa7b03eb16a88422520b02174b377960eeb8bd /src/engine/SCons/Tool/MSCommon | |
parent | b0396109698a6bfb498e722e5aaeba523af6b49f (diff) | |
download | SCons-36c827ec59dca401b20c3bef478b04da738e13f1.zip SCons-36c827ec59dca401b20c3bef478b04da738e13f1.tar.gz SCons-36c827ec59dca401b20c3bef478b04da738e13f1.tar.bz2 |
ENH: raise an exception when we detect an error while executing the batch file.
Diffstat (limited to 'src/engine/SCons/Tool/MSCommon')
-rw-r--r-- | src/engine/SCons/Tool/MSCommon/vc2.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/engine/SCons/Tool/MSCommon/vc2.py b/src/engine/SCons/Tool/MSCommon/vc2.py index 2d246b2..2b89b70 100644 --- a/src/engine/SCons/Tool/MSCommon/vc2.py +++ b/src/engine/SCons/Tool/MSCommon/vc2.py @@ -35,6 +35,9 @@ import common debug = common.debug +class BatchFileExecutionError(Exception): + pass + # Dict to 'canonalize' the arch _ARCH_TO_CANONICAL = { "x86": "x86", @@ -142,6 +145,12 @@ def get_installed_vcs(): def script_env(script, args=None): stdout = common.get_output(script, args) + # Stupid batch files do not set return code: we take a look at the + # beginning of the output for an error message instead + olines = stdout.splitlines() + if olines[0].startswith("The specified configuration type is missing"): + raise BatchFileExecutionError("\n".join(olines[:2])) + return common.parse_output(stdout) def get_default_version(env): @@ -196,7 +205,16 @@ def msvc_setup_env(env): host_target = (host_platform, target_platform) arg = _HOST_TARGET_ARCH_TO_BAT_ARCH[host_target] debug('use_script 2 %s, args:%s\n' % (repr(script), arg)) - d = script_env(script, args=arg) + try: + d = script_env(script, args=arg) + except BatchFileExecutionError, e: + # XXX: find out why warnings do not work here + print "+++++++++++++++++++++++++++++" + msg = "Error while executing %s with args %s (error was %s)" % \ + (script, arg, str(e)) + print msg + print "+++++++++++++++++++++++++++++" + return None else: debug('msvc.get_default_env()\n') d = msvc.get_default_env() |