| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 errno | 5 import errno |
| 6 import os | 6 import os |
| 7 import re | 7 import re |
| 8 import subprocess | 8 import subprocess |
| 9 import sys | 9 import sys |
| 10 | 10 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 # the setup script from the SDK if so. |target_arch| should be either | 60 # the setup script from the SDK if so. |target_arch| should be either |
| 61 # 'x86' or 'x64'. | 61 # 'x86' or 'x64'. |
| 62 assert target_arch in ('x86', 'x64') | 62 assert target_arch in ('x86', 'x64') |
| 63 if bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', 1))) and sdk_dir: | 63 if bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', 1))) and sdk_dir: |
| 64 return [os.path.normpath(os.path.join(sdk_dir, 'Bin/SetEnv.Cmd')), | 64 return [os.path.normpath(os.path.join(sdk_dir, 'Bin/SetEnv.Cmd')), |
| 65 '/' + target_arch] | 65 '/' + target_arch] |
| 66 else: | 66 else: |
| 67 # We only support x64-hosted tools. | 67 # We only support x64-hosted tools. |
| 68 # TODO(scottmg|dpranke): Non-depot_tools toolchain: need to get Visual | 68 # TODO(scottmg|dpranke): Non-depot_tools toolchain: need to get Visual |
| 69 # Studio install location from registry. | 69 # Studio install location from registry. |
| 70 return [os.path.normpath(os.path.join(FIND_VS_IN_REG, 'VC/vcvarsall.bat')), | 70 return [os.path.normpath(os.path.join(os.environ['GYP_MSVS_OVERRIDE_PATH'], |
| 71 'VC/vcvarsall.bat')), |
| 71 'amd64_x86' if target_arch == 'x86' else 'amd64'] | 72 'amd64_x86' if target_arch == 'x86' else 'amd64'] |
| 72 | 73 |
| 73 | 74 |
| 74 def _FormatAsEnvironmentBlock(envvar_dict): | 75 def _FormatAsEnvironmentBlock(envvar_dict): |
| 75 """Format as an 'environment block' directly suitable for CreateProcess. | 76 """Format as an 'environment block' directly suitable for CreateProcess. |
| 76 Briefly this is a list of key=value\0, terminated by an additional \0. See | 77 Briefly this is a list of key=value\0, terminated by an additional \0. See |
| 77 CreateProcess documentation for more details.""" | 78 CreateProcess documentation for more details.""" |
| 78 block = '' | 79 block = '' |
| 79 nul = '\0' | 80 nul = '\0' |
| 80 for key, value in envvar_dict.iteritems(): | 81 for key, value in envvar_dict.iteritems(): |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 env_block = _FormatAsEnvironmentBlock(env) | 141 env_block = _FormatAsEnvironmentBlock(env) |
| 141 with open('environment.' + arch, 'wb') as f: | 142 with open('environment.' + arch, 'wb') as f: |
| 142 f.write(env_block) | 143 f.write(env_block) |
| 143 | 144 |
| 144 assert vc_bin_dir | 145 assert vc_bin_dir |
| 145 print 'vc_bin_dir = "%s"' % vc_bin_dir | 146 print 'vc_bin_dir = "%s"' % vc_bin_dir |
| 146 | 147 |
| 147 | 148 |
| 148 if __name__ == '__main__': | 149 if __name__ == '__main__': |
| 149 main() | 150 main() |
| OLD | NEW |