Gracefully handle not finding the VC and/or SDK setup batch scripts.
authorbdbaddog <bdbaddog@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Fri, 5 Feb 2010 20:42:07 +0000 (20:42 +0000)
committerbdbaddog <bdbaddog@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Fri, 5 Feb 2010 20:42:07 +0000 (20:42 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@4660 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/Tool/MSCommon/vc.py

index efe77fafbb93839fa4a264300b027159313aae3e..53502167a64215352f1be72c67a8a7a4a6b6d1a2 100644 (file)
@@ -362,14 +362,22 @@ def msvc_setup_env(env):
             SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg)
         arg = _HOST_TARGET_ARCH_TO_BAT_ARCH[host_target]
         debug('use_script 2 %s, args:%s\n' % (repr(vc_script), arg))
-        try:
-            d = script_env(vc_script, args=arg)
-        except BatchFileExecutionError, e:
-            #print "Trying:%s"%sdk_script
-            debug('use_script 3: failed running %s: %s: Error:%s'%(repr(vc_script),arg,e))
+        if vc_script:
+            try:
+                d = script_env(vc_script, args=arg)
+            except BatchFileExecutionError, e:
+                debug('use_script 3: failed running VC script %s: %s: Error:%s'%(repr(vc_script),arg,e))
+                vc_script=None
+        if not vc_script and sdk_script:
             debug('use_script 4: trying sdk script: %s %s'%(sdk_script,arg))
-            d = script_env(sdk_script,args=[])
-            #return None
+            try:
+                d = script_env(sdk_script,args=[])
+            except BatchFileExecutionError,e:
+                debug('use_script 5: failed running SDK script %s: Error:%s'%(repr(sdk_script),e))
+                return None
+        else:
+            debug('use_script 6: Neither VC script nor SDK script found')
+            return None
 
     else:
         debug('MSVC_USE_SCRIPT set to False')