Commit 49036091 authored by Jiaxun Wei's avatar Jiaxun Wei Committed by Commit Bot

fix vs%s_install environment variable

Bug: 1061344
Change-Id: If8f966a92069e5d6a6a157e29c3a454678cc9590
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2141564
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Auto-Submit: Jiaxun Wei <leuisken@gmail.com>
Reviewed-by: default avatarBruce Dawson <brucedawson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758230}
parent ee507979
...@@ -151,14 +151,22 @@ def GetVisualStudioVersion(): ...@@ -151,14 +151,22 @@ def GetVisualStudioVersion():
for k,v in MSVS_VERSIONS.items()) for k,v in MSVS_VERSIONS.items())
available_versions = [] available_versions = []
for version in supported_versions: for version in supported_versions:
for path in ( # Checking vs%s_install environment variables.
os.environ.get('vs%s_install' % version), # For example, vs2019_install could have the value
os.path.expandvars('%ProgramFiles(x86)%' + # "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community".
'/Microsoft Visual Studio/%s' % version)): # Only vs2017_install and vs2019_install are supported.
if path and any(os.path.exists(os.path.join(path, edition)) for edition in path = os.environ.get('vs%s_install' % version)
('Enterprise', 'Professional', 'Community', 'Preview')): if path and os.path.exists(path):
available_versions.append(version) available_versions.append(version)
break break
# Detecting VS under possible paths.
path = os.path.expandvars('%ProgramFiles(x86)%' +
'/Microsoft Visual Studio/%s' % version)
if path and any(
os.path.exists(os.path.join(path, edition))
for edition in ('Enterprise', 'Professional', 'Community', 'Preview')):
available_versions.append(version)
break
if not available_versions: if not available_versions:
raise Exception('No supported Visual Studio can be found.' raise Exception('No supported Visual Studio can be found.'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment