]> jfr.im git - irc/quakenet/qwebirc.git/blame - qwebirc/util/autobahn_check.py
add travis build + requirements.txt
[irc/quakenet/qwebirc.git] / qwebirc / util / autobahn_check.py
CommitLineData
27495658 1# at 0.18.2 the project switched to 17.5.1, so this is correct
48f0fc43
CP
2MINIMUM_VERSION = 0, 17, 2
3
4import config
5
6def check():
7 try:
8 import autobahn
9 import autobahn.twisted.websocket
10 import autobahn.twisted.resource
11 except ImportError:
12 return False
13
14 x = autobahn.version.split(".")
15 if len(x) != 3:
16 return "unable to parse autobahn version: %r" % autobahn.version
17
18 major, minor, veryminor = int(x[0]), int(x[1]), int(x[2])
19 if major > MINIMUM_VERSION[0]:
20 pass # ok
27495658 21 elif minor > MINIMUM_VERSION[1]:
48f0fc43 22 pass # ok
27495658 23 elif veryminor >= MINIMUM_VERSION[2]:
48f0fc43
CP
24 pass # ok
25 elif hasattr(config, "FORCE_AUTOBAHN"):
26 pass # ok
27 else:
28 return "your version of autobahn (v%d.%d.%d) is too old, the minimum is v%d.%d.%d" % tuple([major, minor, veryminor] + list(MINIMUM_VERSION))
29
30 return True