Clean up Python 3.2 compatibility cruft.

This commit is contained in:
Florian Bruhin 2014-06-16 11:20:43 +02:00
parent 011bc75a79
commit 3090a6330d
3 changed files with 2 additions and 12 deletions

View File

@ -183,16 +183,7 @@ def shell_escape(s):
# black magic Microshit is doing here.
return s
else:
# Backported from python's shlex because that's only available since
# 3.3 and we might want to support 3.2.
find_unsafe = re.compile(r'[^\w@%+=:,./-]', re.ASCII).search
if not s:
return "''"
if find_unsafe(s) is None:
return s
# use single quotes, and put single quotes into double quotes
# the string $'b is then quoted as '$'"'"'b'
return "'" + s.replace("'", "'\"'\"'") + "'"
return shlex.quote(s)
def pastebin(text):

View File

@ -36,7 +36,7 @@ def enum(*items, start=0):
"""Factory for simple enumerations.
We really don't need more complex things here, so we don't use python3.4's
enum, because we'd have to backport things to 3.3 and maybe even 3.2.
enum, because we'd have to backport things to 3.3.
Based on: http://stackoverflow.com/a/1695250/2085149

View File

@ -108,7 +108,6 @@ setupdata = {
'Operating System :: Microsoft :: Windows :: Windows 7',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Topic :: Internet',