tests: don't test for specific device labels
[pygobject.git] / gi / _compat.py
blob00f5fbb3612ae9ee47e15888ffc8a7890bee9d39
1 # This library is free software; you can redistribute it and/or
2 # modify it under the terms of the GNU Lesser General Public
3 # License as published by the Free Software Foundation; either
4 # version 2.1 of the License, or (at your option) any later version.
6 # This library is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9 # Lesser General Public License for more details.
11 # You should have received a copy of the GNU Lesser General Public
12 # License along with this library; if not, see <http://www.gnu.org/licenses/>.
14 import sys
16 PY2 = PY3 = False
17 if sys.version_info[0] == 2:
18 PY2 = True
20 from StringIO import StringIO
21 StringIO
23 from UserList import UserList
24 UserList
26 long_ = eval("long")
27 integer_types = eval("(int, long)")
28 string_types = eval("(basestring,)")
29 text_type = eval("unicode")
31 reload = eval("reload")
32 xrange = eval("xrange")
33 cmp = eval("cmp")
35 exec("def reraise(tp, value, tb):\n raise tp, value, tb")
36 else:
37 PY3 = True
39 from io import StringIO
40 StringIO
42 from collections import UserList
43 UserList
45 long_ = int
46 integer_types = (int,)
47 string_types = (str,)
48 text_type = str
50 from importlib import reload
51 reload
52 xrange = range
53 cmp = lambda a, b: (a > b) - (a < b)
55 def reraise(tp, value, tb):
56 raise tp(value).with_traceback(tb)