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

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: fancier quoting 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') | test/win/command-quote/command-quote.gyp » ('J')
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..60936341d1f501f2e9c59dd71a48ccd4fee0eb29 100644
--- a/pylib/gyp/msvs_emulation.py
+++ b/pylib/gyp/msvs_emulation.py
@@ -53,7 +53,18 @@ 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.
+ program = args[0] if args else ''
Nico 2012/05/01 17:17:26 nit: I'd `if not args: return ''` at the top inste
scottmg 2012/05/01 18:40:14 Done.
+ if program.startswith('call '):
+ call, space, batch = program.partition(' ')
Nico 2012/05/01 17:17:26 call, batch = program.split(' ', 1) ? Or at least
scottmg 2012/05/01 18:40:14 I always forget about [, maxsplit] on split for so
+ program = 'call ' + QuoteForRspFile(os.path.normpath(batch))
+ else:
+ program = os.path.normpath(program)
+ if ' ' in program:
+ program = QuoteForRspFile(program)
Nico 2012/05/01 17:17:26 You do this here only if ' ' in program, but uncon
scottmg 2012/05/01 18:40:14 Yes, unfortunately. Not adding the quotes here han
+ 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') | test/win/command-quote/command-quote.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698