(versions_to_check, force_express)
return versions
Collect the list of installed visual studio versions.

  Returns:
    A list of visual studio versions installed in descending order of
    usage preference.
    Base this on the registry and a quick check if devenv.exe exists.
    Only versions 8-10 are considered.
    Possibilities are:
      2005(e) - Visual Studio 2005 (8)
      2008(e) - Visual Studio 2008 (9)
      2010(e) - Visual Studio 2010 (10)
      2012(e) - Visual Studio 2012 (11)
      2013(e) - Visual Studio 2013 (11)
    Where (e) is e for express editions of MSVS and blank otherwise.
Collect the list of installed visual studio versions.
Collect the list of installed visual studio versions .
def _DetectVisualStudioVersions(versions_to_check, force_express):
  """Collect the list of installed visual studio versions.

  Returns:
    A list of visual studio versions installed in descending order of
    usage preference.
    Base this on the registry and a quick check if devenv.exe exists.
    Only versions 8-10 are considered.
    Possibilities are:
      2005(e) - Visual Studio 2005 (8)
      2008(e) - Visual Studio 2008 (9)
      2010(e) - Visual Studio 2010 (10)
      2012(e) - Visual Studio 2012 (11)
      2013(e) - Visual Studio 2013 (11)
    Where (e) is e for express editions of MSVS and blank otherwise.
  """
  version_to_year = {
      '8.0': '2005',
      '9.0': '2008',
      '10.0': '2010',
      '11.0': '2012',
      '12.0': '2013',
  }
  versions = []
  for version in versions_to_check:
    # Old method of searching for which VS version is installed
    # We don't use the 2010-encouraged-way because we also want to get the
    # path to the binaries, which it doesn't offer.
    keys = [r'HKLM\Software\Microsoft\VisualStudio\%s' % version,
            r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\%s' % version,
            r'HKLM\Software\Microsoft\VCExpress\%s' % version,
            r'HKLM\Software\Wow6432Node\Microsoft\VCExpress\%s' % version]
    for index in range(len(keys)):
      path = _RegistryGetValue(keys[index], 'InstallDir')
      if not path:
        continue
      path = _ConvertToCygpath(path)
      # Check for full.
      full_path = os.path.join(path, 'devenv.exe')
      express_path = os.path.join(path, '*express.exe')
      if not force_express and os.path.exists(full_path):
        # Add this one.
        versions.append(_CreateVersion(version_to_year[version],
            os.path.join(path, '..', '..')))
      # Check for express.
      elif glob.glob(express_path):
        # Add this one.
        versions.append(_CreateVersion(version_to_year[version] + 'e',
            os.path.join(path, '..', '..')))

    # The old method above does not work when only SDK is installed.
    keys = [r'HKLM\Software\Microsoft\VisualStudio\SxS\VC7',
            r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\SxS\VC7']
    for index in range(len(keys)):
      path = _RegistryGetValue(keys[index], version)
      if not path:
        continue
      path = _ConvertToCygpath(path)
      versions.append(_CreateVersion(version_to_year[version] + 'e',
          os.path.join(path, '..'), sdk_based=True))

  return versions
def _DetectVisualStudioVersions ( versions_to_check , force_express ) : version_to_year = { '8.0' : '2005' , '9.0' : '2008' , '10.0' : '2010' , '11.0' : '2012' , '12.0' : '2013' , } versions = [ ] for version in versions_to_check : # Old method of searching for which VS version is installed # We don't use the 2010-encouraged-way because we also want to get the # path to the binaries, which it doesn't offer. keys = [ r'HKLM\Software\Microsoft\VisualStudio\%s' % version , r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\%s' % version , r'HKLM\Software\Microsoft\VCExpress\%s' % version , r'HKLM\Software\Wow6432Node\Microsoft\VCExpress\%s' % version ] for index in range ( len ( keys ) ) : path = _RegistryGetValue ( keys [ index ] , 'InstallDir' ) if not path : continue path = _ConvertToCygpath ( path ) # Check for full. full_path = os . path . join ( path , 'devenv.exe' ) express_path = os . path . join ( path , '*express.exe' ) if not force_express and os . path . exists ( full_path ) : # Add this one. versions . append ( _CreateVersion ( version_to_year [ version ] , os . path . join ( path , '..' , '..' ) ) ) # Check for express. elif glob . glob ( express_path ) : # Add this one. versions . append ( _CreateVersion ( version_to_year [ version ] + 'e' , os . path . join ( path , '..' , '..' ) ) ) # The old method above does not work when only SDK is installed. keys = [ r'HKLM\Software\Microsoft\VisualStudio\SxS\VC7' , r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\SxS\VC7' ] for index in range ( len ( keys ) ) : path = _RegistryGetValue ( keys [ index ] , version ) if not path : continue path = _ConvertToCygpath ( path ) versions . append ( _CreateVersion ( version_to_year [ version ] + 'e' , os . path . join ( path , '..' ) , sdk_based = True ) ) return versions