Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: build/toolchain/win/setup_toolchain.py

Issue 1556993002: [gn] Detect location of Visual Studio in the registry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Let setup_toolchain.py use vs_toolchain.py Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/vs_toolchain.py » ('j') | build/vs_toolchain.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/toolchain/win/setup_toolchain.py
diff --git a/build/toolchain/win/setup_toolchain.py b/build/toolchain/win/setup_toolchain.py
index 4e79cd904eea00303f17b15380ba7b807ebda02b..86774148393d715828de5a1464cdd77cf4cb2219 100644
--- a/build/toolchain/win/setup_toolchain.py
+++ b/build/toolchain/win/setup_toolchain.py
@@ -55,6 +55,18 @@ def _ExtractImportantEnvironment(output_of_set):
return env
+def _DetectVisualStudioPath():
+ """Return path to the GYP_MSVS_VERSION of Visual Studio
scottmg 2016/01/05 23:30:32 Trailing . on comments.
Daniel Bratell 2016/01/07 16:10:48 Done.
+ """
+
+ # Use the code in build/vs_toolchain.py to avoid duplicating code.
+ this_dir = os.path.dirname(__file__)
scottmg 2016/01/05 23:30:32 I think there's some rule about getting this befor
Daniel Bratell 2016/01/07 16:10:48 Done.
+ chromium_dir = os.path.abspath(os.path.join(this_dir, '..', '..', '..'))
+ sys.path.append(os.path.join(chromium_dir, 'build'))
+ import vs_toolchain
+ return vs_toolchain.DetectVisualStudioPath()
+
+
def _SetupScript(target_cpu, sdk_dir):
"""Returns a command (with arguments) to be used to set up the
environment."""
@@ -66,9 +78,9 @@ def _SetupScript(target_cpu, sdk_dir):
return [os.path.normpath(os.path.join(sdk_dir, 'Bin/SetEnv.Cmd')),
'/' + target_cpu]
else:
+ if not 'GYP_MSVS_OVERRIDE_PATH' in os.environ:
scottmg 2016/01/05 23:30:32 if 'GYP_MSVS_OVERRIDE_PATH' not in os.environ
Daniel Bratell 2016/01/07 16:10:48 Done.
+ os.environ['GYP_MSVS_OVERRIDE_PATH'] = _DetectVisualStudioPath()
# We only support x64-hosted tools.
- # TODO(scottmg|dpranke): Non-depot_tools toolchain: need to get Visual
- # Studio install location from registry.
return [os.path.normpath(os.path.join(os.environ['GYP_MSVS_OVERRIDE_PATH'],
'VC/vcvarsall.bat')),
'amd64_x86' if target_cpu == 'x86' else 'amd64']
« no previous file with comments | « no previous file | build/vs_toolchain.py » ('j') | build/vs_toolchain.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698