 Chromium Code Reviews
 Chromium Code Reviews Issue 10909158:
  Add support for building targets directly from gyp.  (Closed) 
  Base URL: http://gyp.googlecode.com/svn/trunk
    
  
    Issue 10909158:
  Add support for building targets directly from gyp.  (Closed) 
  Base URL: http://gyp.googlecode.com/svn/trunk| 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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 597 result.append('obj.target') | 597 result.append('obj.target') | 
| 598 elif type == self.SHARED_LIB and sys.platform != 'darwin': | 598 elif type == self.SHARED_LIB and sys.platform != 'darwin': | 
| 599 result.append('lib.target') | 599 result.append('lib.target') | 
| 600 subdir = kw.get('subdir') | 600 subdir = kw.get('subdir') | 
| 601 if subdir and type != self.SHARED_LIB: | 601 if subdir and type != self.SHARED_LIB: | 
| 602 result.append(subdir) | 602 result.append(subdir) | 
| 603 result.append(self.built_file_basename(name, type, **kw)) | 603 result.append(self.built_file_basename(name, type, **kw)) | 
| 604 return self.workpath(*result) | 604 return self.workpath(*result) | 
| 605 | 605 | 
| 606 | 606 | 
| 607 def ConvertToCygpath(path): | |
| 
bradn
2012/09/18 00:22:39
Shame its not shared but probably best.
 | |
| 608 """Convert to cygwin path if we are using cygwin.""" | |
| 609 if sys.platform == 'cygwin': | |
| 610 p = subprocess.Popen(["cygpath", path], stdout=subprocess.PIPE) | |
| 
bradn
2012/09/18 00:22:39
single
 
Sam Clegg
2012/09/18 00:47:17
Done.
 | |
| 611 path = p.communicate()[0].strip() | |
| 612 return path | |
| 613 | |
| 614 | |
| 607 def FindVisualStudioInstallation(): | 615 def FindVisualStudioInstallation(): | 
| 608 """Returns appropriate values for .build_tool and .uses_msbuild fields | 616 """Returns appropriate values for .build_tool and .uses_msbuild fields | 
| 609 of TestGypBase for Visual Studio. | 617 of TestGypBase for Visual Studio. | 
| 610 | 618 | 
| 611 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 | 
| 612 search %PATH% and %PATHEXT% for a devenv.{exe,bat,...} executable. | 620 search %PATH% and %PATHEXT% for a devenv.{exe,bat,...} executable. | 
| 613 Failing that, we search for likely deployment paths. | 621 Failing that, we search for likely deployment paths. | 
| 614 """ | 622 """ | 
| 615 possible_roots = ['C:\\Program Files (x86)', 'C:\\Program Files', | 623 possible_roots = ['C:\\Program Files (x86)', 'C:\\Program Files', | 
| 616 'E:\\Program Files (x86)', 'E:\\Program Files'] | 624 'E:\\Program Files (x86)', 'E:\\Program Files'] | 
| 617 possible_paths = { | 625 possible_paths = { | 
| 618 '2010': r'Microsoft Visual Studio 10.0\Common7\IDE\devenv.com', | 626 '2010': r'Microsoft Visual Studio 10.0\Common7\IDE\devenv.com', | 
| 619 '2008': r'Microsoft Visual Studio 9.0\Common7\IDE\devenv.com', | 627 '2008': r'Microsoft Visual Studio 9.0\Common7\IDE\devenv.com', | 
| 620 '2005': r'Microsoft Visual Studio 8\Common7\IDE\devenv.com'} | 628 '2005': r'Microsoft Visual Studio 8\Common7\IDE\devenv.com'} | 
| 621 | 629 | 
| 630 possible_roots = [ConvertToCygpath(r) for r in possible_roots] | |
| 631 | |
| 622 msvs_version = 'auto' | 632 msvs_version = 'auto' | 
| 623 for flag in (f for f in sys.argv if f.startswith('msvs_version=')): | 633 for flag in (f for f in sys.argv if f.startswith('msvs_version=')): | 
| 624 msvs_version = flag.split('=')[-1] | 634 msvs_version = flag.split('=')[-1] | 
| 625 msvs_version = os.environ.get('GYP_MSVS_VERSION', msvs_version) | 635 msvs_version = os.environ.get('GYP_MSVS_VERSION', msvs_version) | 
| 626 | 636 | 
| 627 build_tool = None | 637 build_tool = None | 
| 628 if msvs_version in possible_paths: | 638 if msvs_version in possible_paths: | 
| 629 # Check that the path to the specified GYP_MSVS_VERSION exists. | 639 # Check that the path to the specified GYP_MSVS_VERSION exists. | 
| 630 path = possible_paths[msvs_version] | 640 path = possible_paths[msvs_version] | 
| 631 for r in possible_roots: | 641 for r in possible_roots: | 
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1030 | 1040 | 
| 1031 def TestGyp(*args, **kw): | 1041 def TestGyp(*args, **kw): | 
| 1032 """ | 1042 """ | 
| 1033 Returns an appropriate TestGyp* instance for a specified GYP format. | 1043 Returns an appropriate TestGyp* instance for a specified GYP format. | 
| 1034 """ | 1044 """ | 
| 1035 format = kw.pop('format', os.environ.get('TESTGYP_FORMAT')) | 1045 format = kw.pop('format', os.environ.get('TESTGYP_FORMAT')) | 
| 1036 for format_class in format_class_list: | 1046 for format_class in format_class_list: | 
| 1037 if format == format_class.format: | 1047 if format == format_class.format: | 
| 1038 return format_class(*args, **kw) | 1048 return format_class(*args, **kw) | 
| 1039 raise Exception, "unknown format %r" % format | 1049 raise Exception, "unknown format %r" % format | 
| OLD | NEW |