Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import json | 5 import json |
| 6 import os | 6 import os |
| 7 import pipes | 7 import pipes |
| 8 import shutil | 8 import shutil |
| 9 import subprocess | 9 import subprocess |
| 10 import sys | 10 import sys |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 ] + _GetDesiredVsToolchainHashes() | 157 ] + _GetDesiredVsToolchainHashes() |
| 158 subprocess.check_call(get_toolchain_args) | 158 subprocess.check_call(get_toolchain_args) |
| 159 | 159 |
| 160 return 0 | 160 return 0 |
| 161 | 161 |
| 162 | 162 |
| 163 def GetToolchainDir(): | 163 def GetToolchainDir(): |
| 164 """Gets location information about the current toolchain (must have been | 164 """Gets location information about the current toolchain (must have been |
| 165 previously updated by 'update'). This is used for the GN build.""" | 165 previously updated by 'update'). This is used for the GN build.""" |
| 166 SetEnvironmentAndGetRuntimeDllDirs() | 166 SetEnvironmentAndGetRuntimeDllDirs() |
| 167 depot_tools_win_toolchain = \ | |
| 168 bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1'))) | |
| 169 is_express = os.environ['GYP_MSVS_VERSION'][-1:] == "e" | |
|
scottmg
2014/09/15 23:22:02
nit; just [-1] seems fine since you're comparing a
| |
| 170 if not (depot_tools_win_toolchain or is_express or 'WDK_DIR' in os.environ): | |
| 171 os.environ['WDK_DIR'] = "" | |
|
scottmg
2014/09/15 23:22:02
nit; "" -> ''
| |
| 172 | |
| 167 print '''vs_path = "%s" | 173 print '''vs_path = "%s" |
| 168 sdk_path = "%s" | 174 sdk_path = "%s" |
| 169 vs_version = "%s" | 175 vs_version = "%s" |
| 170 wdk_dir = "%s" | 176 wdk_dir = "%s" |
| 171 ''' % ( | 177 ''' % ( |
| 172 os.environ['GYP_MSVS_OVERRIDE_PATH'], | 178 os.environ['GYP_MSVS_OVERRIDE_PATH'], |
| 173 os.environ['WINDOWSSDKDIR'], | 179 os.environ['WINDOWSSDKDIR'], |
| 174 os.environ['GYP_MSVS_VERSION'], | 180 os.environ['GYP_MSVS_VERSION'], |
| 175 os.environ['WDK_DIR']) | 181 os.environ['WDK_DIR']) |
|
scottmg
2014/09/15 23:22:02
OK, based on explanation, instead just do
os.envi
ckocagil
2014/09/15 23:35:44
I tried not to relax the checks here. This would m
scottmg
2014/09/15 23:45:29
I'd rather not have the extra code, but thanks for
ckocagil
2014/09/15 23:51:16
Done, we use os.environ.get now.
| |
| 176 | 182 |
| 177 | 183 |
| 178 def main(): | 184 def main(): |
| 179 if not sys.platform.startswith(('win32', 'cygwin')): | 185 if not sys.platform.startswith(('win32', 'cygwin')): |
| 180 return 0 | 186 return 0 |
| 181 commands = { | 187 commands = { |
| 182 'update': Update, | 188 'update': Update, |
| 183 'get_toolchain_dir': GetToolchainDir, | 189 'get_toolchain_dir': GetToolchainDir, |
| 184 # TODO(scottmg): Add copy_dlls for GN builds (gyp_chromium calls | 190 # TODO(scottmg): Add copy_dlls for GN builds (gyp_chromium calls |
| 185 # CopyVsRuntimeDlls via import, currently). | 191 # CopyVsRuntimeDlls via import, currently). |
| 186 } | 192 } |
| 187 if len(sys.argv) < 2 or sys.argv[1] not in commands: | 193 if len(sys.argv) < 2 or sys.argv[1] not in commands: |
| 188 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) | 194 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) |
| 189 return 1 | 195 return 1 |
| 190 return commands[sys.argv[1]]() | 196 return commands[sys.argv[1]]() |
| 191 | 197 |
| 192 | 198 |
| 193 if __name__ == '__main__': | 199 if __name__ == '__main__': |
| 194 sys.exit(main()) | 200 sys.exit(main()) |
| OLD | NEW |