1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-09-20 01:06:17 +02:00

python3 compatibility: unicode

reintroduce unicode function - despite the fact I am pretty sure the
usage is plain wrong, because code says - return a unicode string from
utf-8 encoded one, which is probably not what was intended. I bet
something like encode the input as utf-8 was wanted.
This commit is contained in:
Michal Vyskocil 2013-04-09 13:27:24 +02:00 committed by Adrian Schröter
parent 5cc72902e0
commit f6edc186c2

View File

@ -30,6 +30,7 @@ import subprocess
import re
import socket
import errno
try:
from xml.etree import cElementTree as ET
except ImportError:
@ -44,6 +45,13 @@ try:
except NameError:
memoryview = buffer
try:
unicode
except:
#python3 does not have unicode, so lets reimplement it
#as void function as it already gets unicode strings
unicode = lambda x, *args: x
DISTURL_RE = re.compile(r"^(?P<bs>.*)://(?P<apiurl>.*?)/(?P<project>.*?)/(?P<repository>.*?)/(?P<revision>.*)-(?P<source>.*)$")
BUILDLOGURL_RE = re.compile(r"^(?P<apiurl>https?://.*?)/build/(?P<project>.*?)/(?P<repository>.*?)/(?P<arch>.*?)/(?P<package>.*?)/_log$")
BUFSIZE = 1024*1024