Correct argument quoting for Windows platforms.
This commit is contained in:
parent
1e83fc3594
commit
97901d89d9
|
@ -272,9 +272,19 @@ def tmpfile (dir=None, prefix="temp", suffix=None):
|
|||
def shell_quote (value):
|
||||
"""Quote all shell metacharacters in given string value with strong
|
||||
(ie. single) quotes, handling the single quote especially."""
|
||||
if os.name == 'nt':
|
||||
return shell_quote_nt(value)
|
||||
return "'%s'" % value.replace("'", r"'\''")
|
||||
|
||||
|
||||
def shell_quote_nt (value):
|
||||
"""Quote argument for Windows system. Modeled after distutils
|
||||
_nt_quote_args() function."""
|
||||
if " " in value:
|
||||
return '"%s"' % value
|
||||
return value
|
||||
|
||||
|
||||
def stripext (filename):
|
||||
"""Return the basename without extension of given filename."""
|
||||
return os.path.splitext(os.path.basename(filename))[0]
|
||||
|
|
Loading…
Reference in New Issue