diff options
Diffstat (limited to 'Lib/pipes.py')
-rw-r--r-- | Lib/pipes.py | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/Lib/pipes.py b/Lib/pipes.py index 51666a8..693309f 100644 --- a/Lib/pipes.py +++ b/Lib/pipes.py @@ -62,7 +62,9 @@ For an example, see the function test() at the end of the file. import re import os import tempfile -import string +# we import the quote function rather than the module for backward compat +# (quote used to be an undocumented but used function in pipes) +from shlex import quote __all__ = ["Template"] @@ -245,22 +247,3 @@ def makepipeline(infile, steps, outfile): cmdlist = trapcmd + '\n' + cmdlist + '\n' + rmcmd # return cmdlist - - -# Reliably quote a string as a single argument for /bin/sh - -# Safe unquoted -_safechars = frozenset(string.ascii_letters + string.digits + '@%_-+=:,./') - -def quote(file): - """Return a shell-escaped version of the file string.""" - for c in file: - if c not in _safechars: - break - else: - if not file: - return "''" - return file - # use single quotes, and put single quotes into double quotes - # the string $'b is then quoted as '$'"'"'b' - return "'" + file.replace("'", "'\"'\"'") + "'" |