OLD | NEW |
1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 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 """ | 5 """ |
6 TestGyp.py: a testing framework for GYP integration tests. | 6 TestGyp.py: a testing framework for GYP integration tests. |
7 """ | 7 """ |
8 | 8 |
9 import os | 9 import os |
10 import re | 10 import re |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 | 613 |
614 | 614 |
615 def FindVisualStudioInstallation(): | 615 def FindVisualStudioInstallation(): |
616 """Returns appropriate values for .build_tool and .uses_msbuild fields | 616 """Returns appropriate values for .build_tool and .uses_msbuild fields |
617 of TestGypBase for Visual Studio. | 617 of TestGypBase for Visual Studio. |
618 | 618 |
619 We use the value specified by GYP_MSVS_VERSION. If not specified, we | 619 We use the value specified by GYP_MSVS_VERSION. If not specified, we |
620 search %PATH% and %PATHEXT% for a devenv.{exe,bat,...} executable. | 620 search %PATH% and %PATHEXT% for a devenv.{exe,bat,...} executable. |
621 Failing that, we search for likely deployment paths. | 621 Failing that, we search for likely deployment paths. |
622 """ | 622 """ |
623 possible_roots = ['C:\\Program Files (x86)', 'C:\\Program Files', | 623 possible_roots = ['%s:\\Program Files%s' % (chr(drive), suffix) |
624 'E:\\Program Files (x86)', 'E:\\Program Files'] | 624 for drive in range(ord('C'), ord('Z') + 1) |
| 625 for suffix in ['', ' (x86)']] |
625 possible_paths = { | 626 possible_paths = { |
| 627 '2012': r'Microsoft Visual Studio 11.0\Common7\IDE\devenv.com', |
626 '2010': r'Microsoft Visual Studio 10.0\Common7\IDE\devenv.com', | 628 '2010': r'Microsoft Visual Studio 10.0\Common7\IDE\devenv.com', |
627 '2008': r'Microsoft Visual Studio 9.0\Common7\IDE\devenv.com', | 629 '2008': r'Microsoft Visual Studio 9.0\Common7\IDE\devenv.com', |
628 '2005': r'Microsoft Visual Studio 8\Common7\IDE\devenv.com'} | 630 '2005': r'Microsoft Visual Studio 8\Common7\IDE\devenv.com'} |
629 | 631 |
630 possible_roots = [ConvertToCygpath(r) for r in possible_roots] | 632 possible_roots = [ConvertToCygpath(r) for r in possible_roots] |
631 | 633 |
632 msvs_version = 'auto' | 634 msvs_version = 'auto' |
633 for flag in (f for f in sys.argv if f.startswith('msvs_version=')): | 635 for flag in (f for f in sys.argv if f.startswith('msvs_version=')): |
634 msvs_version = flag.split('=')[-1] | 636 msvs_version = flag.split('=')[-1] |
635 msvs_version = os.environ.get('GYP_MSVS_VERSION', msvs_version) | 637 msvs_version = os.environ.get('GYP_MSVS_VERSION', msvs_version) |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 | 1042 |
1041 def TestGyp(*args, **kw): | 1043 def TestGyp(*args, **kw): |
1042 """ | 1044 """ |
1043 Returns an appropriate TestGyp* instance for a specified GYP format. | 1045 Returns an appropriate TestGyp* instance for a specified GYP format. |
1044 """ | 1046 """ |
1045 format = kw.pop('format', os.environ.get('TESTGYP_FORMAT')) | 1047 format = kw.pop('format', os.environ.get('TESTGYP_FORMAT')) |
1046 for format_class in format_class_list: | 1048 for format_class in format_class_list: |
1047 if format == format_class.format: | 1049 if format == format_class.format: |
1048 return format_class(*args, **kw) | 1050 return format_class(*args, **kw) |
1049 raise Exception, "unknown format %r" % format | 1051 raise Exception, "unknown format %r" % format |
OLD | NEW |