Chromium Code Reviews| 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 # Copies the given "win tool" (which the toolchain uses to wrap compiler | 5 # Copies the given "win tool" (which the toolchain uses to wrap compiler |
| 6 # invocations) and the environment blocks for the 32-bit and 64-bit builds on | 6 # invocations) and the environment blocks for the 32-bit and 64-bit builds on |
| 7 # Windows to the build directory. | 7 # Windows to the build directory. |
| 8 # | 8 # |
| 9 # The arguments are the visual studio install location and the location of the | 9 # The arguments are the visual studio install location and the location of the |
| 10 # win tool. The script assumes that the root build directory is the current dir | 10 # win tool. The script assumes that the root build directory is the current dir |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 script = os.path.normpath(os.path.join(sdk_dir, 'Bin/SetEnv.cmd')) | 117 script = os.path.normpath(os.path.join(sdk_dir, 'Bin/SetEnv.cmd')) |
| 118 assert _ExtractImportantEnvironment(variables) == \ | 118 assert _ExtractImportantEnvironment(variables) == \ |
| 119 _ExtractImportantEnvironment(_LoadEnvFromBat([script, '/' + cpu])) | 119 _ExtractImportantEnvironment(_LoadEnvFromBat([script, '/' + cpu])) |
| 120 else: | 120 else: |
| 121 if 'GYP_MSVS_OVERRIDE_PATH' not in os.environ: | 121 if 'GYP_MSVS_OVERRIDE_PATH' not in os.environ: |
| 122 os.environ['GYP_MSVS_OVERRIDE_PATH'] = _DetectVisualStudioPath() | 122 os.environ['GYP_MSVS_OVERRIDE_PATH'] = _DetectVisualStudioPath() |
| 123 # We only support x64-hosted tools. | 123 # We only support x64-hosted tools. |
| 124 script_path = os.path.normpath(os.path.join( | 124 script_path = os.path.normpath(os.path.join( |
| 125 os.environ['GYP_MSVS_OVERRIDE_PATH'], | 125 os.environ['GYP_MSVS_OVERRIDE_PATH'], |
| 126 'VC/vcvarsall.bat')) | 126 'VC/vcvarsall.bat')) |
| 127 if not os.path.exists(script_path): | 127 if os.path.exists(script_path): |
| 128 raise Exception('%s is missing - make sure VC++ tools are installed.' % | 128 args = [script_path, 'amd64_x86' if cpu == 'x86' else 'amd64'] |
| 129 script_path) | 129 variables = _LoadEnvFromBat(args) |
| 130 args = [script_path, 'amd64_x86' if cpu == 'x86' else 'amd64'] | 130 else: |
| 131 variables = _LoadEnvFromBat(args) | 131 variables = [] |
|
brucedawson
2016/07/07 23:31:38
My only concern is that this might make some failu
| |
| 132 for k in sorted(os.environ.keys()): | |
| 133 variables.append('%s=%s' % (str(k), str(os.environ[k]))) | |
| 134 variables = '\n'.join(variables) | |
| 132 return _ExtractImportantEnvironment(variables) | 135 return _ExtractImportantEnvironment(variables) |
| 133 | 136 |
| 134 | 137 |
| 135 def _FormatAsEnvironmentBlock(envvar_dict): | 138 def _FormatAsEnvironmentBlock(envvar_dict): |
| 136 """Format as an 'environment block' directly suitable for CreateProcess. | 139 """Format as an 'environment block' directly suitable for CreateProcess. |
| 137 Briefly this is a list of key=value\0, terminated by an additional \0. See | 140 Briefly this is a list of key=value\0, terminated by an additional \0. See |
| 138 CreateProcess documentation for more details.""" | 141 CreateProcess documentation for more details.""" |
| 139 block = '' | 142 block = '' |
| 140 nul = '\0' | 143 nul = '\0' |
| 141 for key, value in envvar_dict.iteritems(): | 144 for key, value in envvar_dict.iteritems(): |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 | 225 |
| 223 assert vc_bin_dir | 226 assert vc_bin_dir |
| 224 assert '"' not in vc_bin_dir | 227 assert '"' not in vc_bin_dir |
| 225 print 'vc_bin_dir = "%s"' % vc_bin_dir | 228 print 'vc_bin_dir = "%s"' % vc_bin_dir |
| 226 assert include | 229 assert include |
| 227 assert '"' not in include | 230 assert '"' not in include |
| 228 print 'include_flags = "%s"' % include | 231 print 'include_flags = "%s"' % include |
| 229 | 232 |
| 230 if __name__ == '__main__': | 233 if __name__ == '__main__': |
| 231 main() | 234 main() |
| OLD | NEW |