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 This module helps emulate Visual Studio 2008 behavior on top of other | 6 This module helps emulate Visual Studio 2008 behavior on top of other |
7 build systems, primarily ninja. | 7 build systems, primarily ninja. |
8 """ | 8 """ |
9 | 9 |
10 import os | 10 import os |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 replacements['$(WDK_DIR)'] = self.wdk_dir if self.wdk_dir else '' | 195 replacements['$(WDK_DIR)'] = self.wdk_dir if self.wdk_dir else '' |
196 return replacements | 196 return replacements |
197 | 197 |
198 def ConvertVSMacros(self, s, base_to_build=None, config=None): | 198 def ConvertVSMacros(self, s, base_to_build=None, config=None): |
199 """Convert from VS macro names to something equivalent.""" | 199 """Convert from VS macro names to something equivalent.""" |
200 env = self.GetVSMacroEnv(base_to_build, config=config) | 200 env = self.GetVSMacroEnv(base_to_build, config=config) |
201 return ExpandMacros(s, env) | 201 return ExpandMacros(s, env) |
202 | 202 |
203 def AdjustLibraries(self, libraries): | 203 def AdjustLibraries(self, libraries): |
204 """Strip -l from library if it's specified with that.""" | 204 """Strip -l from library if it's specified with that.""" |
205 return [lib[2:] if lib.startswith('-l') else lib for lib in libraries] | 205 libs = [lib[2:] if lib.startswith('-l') else lib for lib in libraries] |
scottmg
2013/09/27 20:38:47
nit; extra space before list comprehension
| |
206 return [lib + '.lib' if not lib.endswith('.lib') else lib for lib in libs] | |
206 | 207 |
207 def _GetAndMunge(self, field, path, default, prefix, append, map): | 208 def _GetAndMunge(self, field, path, default, prefix, append, map): |
208 """Retrieve a value from |field| at |path| or return |default|. If | 209 """Retrieve a value from |field| at |path| or return |default|. If |
209 |append| is specified, and the item is found, it will be appended to that | 210 |append| is specified, and the item is found, it will be appended to that |
210 object instead of returned. If |map| is specified, results will be | 211 object instead of returned. If |map| is specified, results will be |
211 remapped through |map| before being returned or appended.""" | 212 remapped through |map| before being returned or appended.""" |
212 result = _GenericRetrieve(field, default, path) | 213 result = _GenericRetrieve(field, default, path) |
213 result = _DoRemapping(result, map) | 214 result = _DoRemapping(result, map) |
214 result = _AddPrefix(result, prefix) | 215 result = _AddPrefix(result, prefix) |
215 return _AppendOrReturn(append, result) | 216 return _AppendOrReturn(append, result) |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
841 so they're not surprised when the VS build fails.""" | 842 so they're not surprised when the VS build fails.""" |
842 if int(generator_flags.get('msvs_error_on_missing_sources', 0)): | 843 if int(generator_flags.get('msvs_error_on_missing_sources', 0)): |
843 no_specials = filter(lambda x: '$' not in x, sources) | 844 no_specials = filter(lambda x: '$' not in x, sources) |
844 relative = [os.path.join(build_dir, gyp_to_ninja(s)) for s in no_specials] | 845 relative = [os.path.join(build_dir, gyp_to_ninja(s)) for s in no_specials] |
845 missing = filter(lambda x: not os.path.exists(x), relative) | 846 missing = filter(lambda x: not os.path.exists(x), relative) |
846 if missing: | 847 if missing: |
847 # They'll look like out\Release\..\..\stuff\things.cc, so normalize the | 848 # They'll look like out\Release\..\..\stuff\things.cc, so normalize the |
848 # path for a slightly less crazy looking output. | 849 # path for a slightly less crazy looking output. |
849 cleaned_up = [os.path.normpath(x) for x in missing] | 850 cleaned_up = [os.path.normpath(x) for x in missing] |
850 raise Exception('Missing input files:\n%s' % '\n'.join(cleaned_up)) | 851 raise Exception('Missing input files:\n%s' % '\n'.join(cleaned_up)) |
OLD | NEW |