Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Unified Diff: pylib/gyp/msvs_emulation.py

Issue 10269018: ninja windows: handle more cases in program quoting (Closed) Base URL: https://gyp.googlecode.com/svn/trunk
Patch Set: additional test, add missing file Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/win/command-quote/a.S » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pylib/gyp/msvs_emulation.py
diff --git a/pylib/gyp/msvs_emulation.py b/pylib/gyp/msvs_emulation.py
index eb9e0affeb035b66494c0f7bf6384092afa54d7f..12f9380593d5b84a93bdc9a513b2ee1a0a9cb8f2 100644
--- a/pylib/gyp/msvs_emulation.py
+++ b/pylib/gyp/msvs_emulation.py
@@ -53,7 +53,21 @@ def QuoteForRspFile(arg):
def EncodeRspFileList(args):
"""Process a list of arguments using QuoteCmdExeArgument."""
- return ' '.join(QuoteForRspFile(arg) for arg in args)
+ # Note that the first argument is assumed to be the command. We take extra
+ # steps to make sure that calls to .bat files are handled correctly, and
+ # that paths are normalized and quoted as necessary.
+ if not args: return ''
+ program = args[0]
+ if program.startswith('call '):
+ call, batch = program.split(' ', 1)
+ program = 'call ' + QuoteForRspFile(os.path.normpath(batch))
+ else:
+ program = os.path.normpath(program)
+ # Don't add quotes around things without spaces so that 'call', 'echo',
+ # etc. will work if they're specified as individual arguments.
+ if ' ' in program:
+ program = QuoteForRspFile(program)
+ return program + ' ' + ' '.join(QuoteForRspFile(arg) for arg in args[1:])
def _GenericRetrieve(root, default, path):
« no previous file with comments | « no previous file | test/win/command-quote/a.S » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698