| OLD | NEW |
| 1 # Copyright (c) 2013 Google Inc. All rights reserved. | 1 # Copyright (c) 2013 Google Inc. 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 """Handle version information related to Visual Stuio.""" | 5 """Handle version information related to Visual Stuio.""" |
| 6 | 6 |
| 7 import errno | 7 import errno |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 import subprocess | 10 import subprocess |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 | 372 |
| 373 Arguments: | 373 Arguments: |
| 374 version: Hook to allow caller to force a particular version (vs auto). | 374 version: Hook to allow caller to force a particular version (vs auto). |
| 375 Returns: | 375 Returns: |
| 376 An object representing a visual studio project format version. | 376 An object representing a visual studio project format version. |
| 377 """ | 377 """ |
| 378 # In auto mode, check environment variable for override. | 378 # In auto mode, check environment variable for override. |
| 379 if version == 'auto': | 379 if version == 'auto': |
| 380 version = os.environ.get('GYP_MSVS_VERSION', 'auto') | 380 version = os.environ.get('GYP_MSVS_VERSION', 'auto') |
| 381 version_map = { | 381 version_map = { |
| 382 'auto': ('10.0', '12.0', '9.0', '8.0', '11.0'), | 382 'auto': ('12.0', '10.0', '9.0', '8.0', '11.0'), |
| 383 '2005': ('8.0',), | 383 '2005': ('8.0',), |
| 384 '2005e': ('8.0',), | 384 '2005e': ('8.0',), |
| 385 '2008': ('9.0',), | 385 '2008': ('9.0',), |
| 386 '2008e': ('9.0',), | 386 '2008e': ('9.0',), |
| 387 '2010': ('10.0',), | 387 '2010': ('10.0',), |
| 388 '2010e': ('10.0',), | 388 '2010e': ('10.0',), |
| 389 '2012': ('11.0',), | 389 '2012': ('11.0',), |
| 390 '2012e': ('11.0',), | 390 '2012e': ('11.0',), |
| 391 '2013': ('12.0',), | 391 '2013': ('12.0',), |
| 392 '2013e': ('12.0',), | 392 '2013e': ('12.0',), |
| 393 } | 393 } |
| 394 override_path = os.environ.get('GYP_MSVS_OVERRIDE_PATH') | 394 override_path = os.environ.get('GYP_MSVS_OVERRIDE_PATH') |
| 395 if override_path: | 395 if override_path: |
| 396 msvs_version = os.environ.get('GYP_MSVS_VERSION') | 396 msvs_version = os.environ.get('GYP_MSVS_VERSION') |
| 397 if not msvs_version: | 397 if not msvs_version: |
| 398 raise ValueError('GYP_MSVS_OVERRIDE_PATH requires GYP_MSVS_VERSION to be ' | 398 raise ValueError('GYP_MSVS_OVERRIDE_PATH requires GYP_MSVS_VERSION to be ' |
| 399 'set to a particular version (e.g. 2010e).') | 399 'set to a particular version (e.g. 2010e).') |
| 400 return _CreateVersion(msvs_version, override_path, sdk_based=True) | 400 return _CreateVersion(msvs_version, override_path, sdk_based=True) |
| 401 version = str(version) | 401 version = str(version) |
| 402 versions = _DetectVisualStudioVersions(version_map[version], 'e' in version) | 402 versions = _DetectVisualStudioVersions(version_map[version], 'e' in version) |
| 403 if not versions: | 403 if not versions: |
| 404 if version == 'auto': | 404 if version == 'auto': |
| 405 # Default to 2005 if we couldn't find anything | 405 # Default to 2005 if we couldn't find anything |
| 406 return _CreateVersion('2005', None) | 406 return _CreateVersion('2005', None) |
| 407 else: | 407 else: |
| 408 return _CreateVersion(version, None) | 408 return _CreateVersion(version, None) |
| 409 return versions[0] | 409 return versions[0] |
| OLD | NEW |