py3: Add Python 2/3 compat module
Keep all the hacks in a single place. This looks like all we need, so no need to depend on six.
This commit is contained in:
parent
98ca748996
commit
b9a5192d5f
24
mopidy/utils/compat.py
Normal file
24
mopidy/utils/compat.py
Normal file
@ -0,0 +1,24 @@
|
||||
import sys
|
||||
|
||||
PY2 = sys.version_info[0] == 2
|
||||
PY3 = sys.version_info[0] == 3
|
||||
|
||||
if PY2:
|
||||
import ConfigParser as configparser # noqa
|
||||
import Queue as queue # noqa
|
||||
import thread # noqa
|
||||
|
||||
string_types = basestring
|
||||
text_type = unicode
|
||||
|
||||
input = raw_input
|
||||
|
||||
else:
|
||||
import configparser # noqa
|
||||
import queue # noqa
|
||||
import _thread as thread # noqa
|
||||
|
||||
string_types = (str,)
|
||||
text_type = str
|
||||
|
||||
input = input
|
||||
Loading…
Reference in New Issue
Block a user