From b9a5192d5fab2d08bd0ab54ea9e81e6f48728ccd Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Sun, 7 Dec 2014 20:08:01 +0100 Subject: [PATCH] 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. --- mopidy/utils/compat.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 mopidy/utils/compat.py diff --git a/mopidy/utils/compat.py b/mopidy/utils/compat.py new file mode 100644 index 00000000..d0e4aeb2 --- /dev/null +++ b/mopidy/utils/compat.py @@ -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