Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import json | 6 import json |
| 7 import os | 7 import os |
| 8 import pipes | 8 import pipes |
| 9 import shutil | 9 import shutil |
| 10 import subprocess | 10 import subprocess |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 | 100 |
| 101 def DetectVisualStudioPath(): | 101 def DetectVisualStudioPath(): |
| 102 """Return path to the GYP_MSVS_VERSION of Visual Studio. | 102 """Return path to the GYP_MSVS_VERSION of Visual Studio. |
| 103 """ | 103 """ |
| 104 | 104 |
| 105 # Note that this code is used from | 105 # Note that this code is used from |
| 106 # build/toolchain/win/setup_toolchain.py as well. | 106 # build/toolchain/win/setup_toolchain.py as well. |
| 107 | 107 |
| 108 # Default to Visual Studio 2013 for now. | 108 # Default to Visual Studio 2013 for now. |
| 109 version_as_year = os.environ.get('GYP_MSVS_VERSION', '2013') | 109 version_as_year = os.environ.get('GYP_MSVS_VERSION', '2013') |
| 110 os.environ['GYP_MSVS_VERSION'] = version_as_year | |
|
Daniel Bratell
2016/01/12 08:42:02
From a code maintenance point of view it doesn't s
| |
| 110 year_to_version = { | 111 year_to_version = { |
| 111 '2013': '12.0', | 112 '2013': '12.0', |
| 112 '2015': '14.0', | 113 '2015': '14.0', |
| 113 } | 114 } |
| 114 if version_as_year not in year_to_version: | 115 if version_as_year not in year_to_version: |
| 115 raise Exception(('Visual Studio version %s (from GYP_MSVS_VERSION)' | 116 raise Exception(('Visual Studio version %s (from GYP_MSVS_VERSION)' |
| 116 ' not supported. Supported versions are: %s') % ( | 117 ' not supported. Supported versions are: %s') % ( |
| 117 version_as_year, ', '.join(year_to_version.keys()))) | 118 version_as_year, ', '.join(year_to_version.keys()))) |
| 118 version = year_to_version[version_as_year] | 119 version = year_to_version[version_as_year] |
| 119 keys = [r'HKLM\Software\Microsoft\VisualStudio\%s' % version, | 120 keys = [r'HKLM\Software\Microsoft\VisualStudio\%s' % version, |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 325 'copy_dlls': CopyDlls, | 326 'copy_dlls': CopyDlls, |
| 326 } | 327 } |
| 327 if len(sys.argv) < 2 or sys.argv[1] not in commands: | 328 if len(sys.argv) < 2 or sys.argv[1] not in commands: |
| 328 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) | 329 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) |
| 329 return 1 | 330 return 1 |
| 330 return commands[sys.argv[1]](*sys.argv[2:]) | 331 return commands[sys.argv[1]](*sys.argv[2:]) |
| 331 | 332 |
| 332 | 333 |
| 333 if __name__ == '__main__': | 334 if __name__ == '__main__': |
| 334 sys.exit(main()) | 335 sys.exit(main()) |
| OLD | NEW |