From 75d502ef110d2a3d37f419bd63166566eb7c11c7 Mon Sep 17 00:00:00 2001 From: cournape Date: Thu, 19 Nov 2009 05:07:01 +0000 Subject: [PATCH] BUG: catch any VisualCException when querying available versions through find_vc_pdir. git-svn-id: http://scons.tigris.org/svn/scons/trunk@4456 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/engine/SCons/Tool/MSCommon/vc.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 4efa0a0f..64157835 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -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): -- 2.26.2