()
Return path to the GYP_MSVS_VERSION of Visual Studio.
Return path to the GYP_MSVS_VERSION of Visual Studio.
Return path to the GYP_MSVS_VERSION of Visual Studio .
def DetectVisualStudioPath():
  """Return path to the GYP_MSVS_VERSION of Visual Studio.
  """

  # Note that this code is used from
  # build/toolchain/win/setup_toolchain.py as well.
  version_as_year = GetVisualStudioVersion()
  year_to_version = {
      '2013': '12.0',
      '2015': '14.0',
  }
  if version_as_year not in year_to_version:
    raise Exception(('Visual Studio version %s (from GYP_MSVS_VERSION)'
                     ' not supported. Supported versions are: %s') % (
                       version_as_year, ', '.join(year_to_version.keys())))
  version = year_to_version[version_as_year]
  keys = [r'HKLM\Software\Microsoft\VisualStudio\%s' % version,
          r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\%s' % version]
  for key in keys:
    path = _RegistryGetValue(key, 'InstallDir')
    if not path:
      continue
    path = os.path.normpath(os.path.join(path, '..', '..'))
    return path

  raise Exception(('Visual Studio Version %s (from GYP_MSVS_VERSION)'
                   ' not found.') % (version_as_year))
def DetectVisualStudioPath ( ) : # Note that this code is used from # build/toolchain/win/setup_toolchain.py as well. version_as_year = GetVisualStudioVersion ( ) year_to_version = { '2013' : '12.0' , '2015' : '14.0' , } if version_as_year not in year_to_version : raise Exception ( ( 'Visual Studio version %s (from GYP_MSVS_VERSION)' ' not supported. Supported versions are: %s' ) % ( version_as_year , ', ' . join ( year_to_version . keys ( ) ) ) ) version = year_to_version [ version_as_year ] keys = [ r'HKLM\Software\Microsoft\VisualStudio\%s' % version , r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\%s' % version ] for key in keys : path = _RegistryGetValue ( key , 'InstallDir' ) if not path : continue path = os . path . normpath ( os . path . join ( path , '..' , '..' ) ) return path raise Exception ( ( 'Visual Studio Version %s (from GYP_MSVS_VERSION)' ' not found.' ) % ( version_as_year ) )