remoting/tools/zip2msi.py
def QuoteArgument(arg):
  """Escapes a Windows command-line argument.

  So that the Win32 CommandLineToArgv function will turn the escaped result back
  into the original string.
  See http://msdn.microsoft.com/en-us/library/17w5ykft.aspx
  ("Parsing C++ Command-Line Arguments") to understand why we have to do
  this.

  Args:
      arg: the string to be escaped.
  Returns:
      the escaped string.
  """

  def _Replace(match):
    # For a literal quote, CommandLineToArgv requires an odd number of
    # backslashes preceding it, and it produces half as many literal backslashes
    # (rounded down). So we need to produce 2n+1 backslashes.
    return 2 * match.group(1) + '\\"'

  if re.search(quote_matcher_regex, arg):
    # Escape all quotes so that they are interpreted literally.
    arg = quote_replacer_regex.sub(_Replace, arg)
    # Now add unescaped quotes so that any whitespace is interpreted literally.
    return '"' + arg + '"'
  else:
    return arg
Escapes a Windows command-line argument.

  So that the Win32 CommandLineToArgv function will turn the escaped result back
  into the original string.
  See http://msdn.microsoft.com/en-us/library/17w5ykft.aspx
  ("Parsing C++ Command-Line Arguments") to understand why we have to do
  this.

  Args:
      arg: the string to be escaped.
  Returns:
      the escaped string.
  
Escapes a Windows command-line argument.
So that the Win32 CommandLineToArgv function will turn the escaped result back
into the original string.
Escapes a Windows command - line argument . So that the Win32 CommandLineToArgv function will turn the escaped result back into the original string .
def QuoteArgument(arg):
  def _Replace(match):
    return 2 * match.group(1) + '\\"'
  if re.search(quote_matcher_regex, arg):
    arg = quote_replacer_regex.sub(_Replace, arg)
    return '"' + arg + '"'
  else:
    return arg
def QuoteArgument ( arg ) : def _Replace ( match ) : return 2 * match . group ( 1 ) + '\\"' if re . search ( quote_matcher_regex , arg ) : arg = quote_replacer_regex . sub ( _Replace , arg ) return '"' + arg + '"' else : return arg
Escapes a Windows command-line argument.
Escapes a Windows command - line argument .
"""Escapes a Windows command-line argument.

  So that the Win32 CommandLineToArgv function will turn the escaped result back
  into the original string.
  See http://msdn.microsoft.com/en-us/library/17w5ykft.aspx
  ("Parsing C++ Command-Line Arguments") to understand why we have to do
  this.

  Args:
      arg: the string to be escaped.
  Returns:
      the escaped string.
  """ # For a literal quote, CommandLineToArgv requires an odd number of # backslashes preceding it, and it produces half as many literal backslashes # (rounded down). So we need to produce 2n+1 backslashes. # Escape all quotes so that they are interpreted literally. # Now add unescaped quotes so that any whitespace is interpreted literally.
the escaped string.
the escaped string .
arg
the string to be escaped.
the string to be escaped .