BUG: catch any VisualCException when querying available versions through find_vc_pdir.
authorcournape <cournape@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 19 Nov 2009 05:07:01 +0000 (05:07 +0000)
committercournape <cournape@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 19 Nov 2009 05:07:01 +0000 (05:07 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@4456 fdb21ef1-2011-0410-befe-b5e4ea1792b1

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

index 4efa0a0f6b55949608c4b8e26a44cdc4f44a9762..6415783576fa557e2ebdcd634900522ea7e92623 100644 (file)
@@ -121,7 +121,12 @@ _VCVER_TO_PRODUCT_DIR = {
 
 def find_vc_pdir(msvc_version):
     """Try to find the product directory for the given
-    version."""
+    version.
+
+    Note
+    ----
+    If for some reason the requested version could not be found, an
+    exception which inherits from VisualCException will be raised."""
     root = 'Software\\'
     if common.is_win64():
         root = root + 'Wow6432Node\\'
@@ -173,9 +178,14 @@ def get_installed_vcs():
     installed_versions = []
     for ver in _VCVER:
         debug('trying to find VC %s' % ver)
-        if find_vc_pdir(ver):
-            debug('found VC %s' % ver)
-            installed_versions.append(ver)
+        try:
+            if find_vc_pdir(ver):
+                debug('found VC %s' % ver)
+                installed_versions.append(ver)
+            else:
+                debug('find_vc_pdir return None for ver %s' % ver)
+        except VisualCException, e:
+            debug('did not find VC %s: caught exception %s' % (ver, str(e)))
     return installed_versions
 
 def script_env(script, args=None):