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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 | 53 |
54 def EncodeRspFileList(args): | 54 def EncodeRspFileList(args): |
55 """Process a list of arguments using QuoteCmdExeArgument.""" | 55 """Process a list of arguments using QuoteCmdExeArgument.""" |
56 # Note that the first argument is assumed to be the command. Don't add | 56 # Note that the first argument is assumed to be the command. Don't add |
57 # quotes around it because then commands like 'call x.bat' or shell | 57 # quotes around it because then commands like 'call x.bat' or shell |
58 # built-ins like 'echo', etc. won't work. Also, don't bother special casing | 58 # built-ins like 'echo', etc. won't work. Also, don't bother special casing |
59 # to get quotes around the remainder (after 'call') since other generators | 59 # to get quotes around the remainder (after 'call') since other generators |
60 # and gyp in general don't really support spaces in paths. | 60 # and gyp in general don't really support spaces in paths. |
61 if not args: return '' | 61 if not args: return '' |
62 program = args[0] | 62 program = os.path.normpath(args[0]) |
63 return program + ' ' + ' '.join(QuoteForRspFile(arg) for arg in args[1:]) | 63 return program + ' ' + ' '.join(QuoteForRspFile(arg) for arg in args[1:]) |
64 | 64 |
65 | 65 |
66 def _GenericRetrieve(root, default, path): | 66 def _GenericRetrieve(root, default, path): |
67 """Given a list of dictionary keys |path| and a tree of dicts |root|, find | 67 """Given a list of dictionary keys |path| and a tree of dicts |root|, find |
68 value at path, or return |default| if any of the path doesn't exist.""" | 68 value at path, or return |default| if any of the path doesn't exist.""" |
69 if not root: | 69 if not root: |
70 return default | 70 return default |
71 if not path: | 71 if not path: |
72 return root | 72 return root |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 return vs.SetupScript() | 463 return vs.SetupScript() |
464 | 464 |
465 def ExpandMacros(string, expansions): | 465 def ExpandMacros(string, expansions): |
466 """Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv | 466 """Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv |
467 for the canonical way to retrieve a suitable dict.""" | 467 for the canonical way to retrieve a suitable dict.""" |
468 if '$' in string: | 468 if '$' in string: |
469 for old, new in expansions.iteritems(): | 469 for old, new in expansions.iteritems(): |
470 assert '$(' not in new, new | 470 assert '$(' not in new, new |
471 string = string.replace(old, new) | 471 string = string.replace(old, new) |
472 return string | 472 return string |
OLD | NEW |