Show More
@@ -1,42 +1,39 b'' | |||
|
1 | 1 | #----------------------------------------------------------------------------- |
|
2 | 2 | # Copyright (C) 2010 The IPython Development Team |
|
3 | 3 | # |
|
4 | 4 | # Distributed under the terms of the BSD License. The full license is in |
|
5 | 5 | # the file COPYING.txt, distributed as part of this software. |
|
6 | 6 | #----------------------------------------------------------------------------- |
|
7 | 7 | |
|
8 | 8 | #----------------------------------------------------------------------------- |
|
9 | 9 | # Verify zmq version dependency >= 2.1.4 |
|
10 | 10 | #----------------------------------------------------------------------------- |
|
11 | 11 | |
|
12 | import re | |
|
13 | 12 | import warnings |
|
13 | from pkg_resources import parse_version as V | |
|
14 | 14 | |
|
15 | 15 | def check_for_zmq(minimum_version, module='IPython.zmq'): |
|
16 | min_vlist = [int(n) for n in minimum_version.split('.')] | |
|
17 | ||
|
18 | 16 | try: |
|
19 | 17 | import zmq |
|
20 | 18 | except ImportError: |
|
21 | 19 | raise ImportError("%s requires pyzmq >= %s"%(module, minimum_version)) |
|
22 | 20 | |
|
23 | 21 | pyzmq_version = zmq.__version__ |
|
24 | vlist = [int(n) for n in re.findall(r'\d+', pyzmq_version)] | |
|
25 | ||
|
26 | if 'dev' not in pyzmq_version and vlist < min_vlist: | |
|
22 | ||
|
23 | if V(pyzmq_version) < V(minimum_version): | |
|
27 | 24 | raise ImportError("%s requires pyzmq >= %s, but you have %s"%( |
|
28 | 25 | module, minimum_version, pyzmq_version)) |
|
29 | 26 | |
|
30 | 27 | # fix missing DEALER/ROUTER aliases in pyzmq < 2.1.9 |
|
31 | 28 | if not hasattr(zmq, 'DEALER'): |
|
32 | 29 | zmq.DEALER = zmq.XREQ |
|
33 | 30 | if not hasattr(zmq, 'ROUTER'): |
|
34 | 31 | zmq.ROUTER = zmq.XREP |
|
35 | 32 | |
|
36 | if zmq.zmq_version() >= '4.0.0': | |
|
33 | if V(zmq.zmq_version()) >= V('4.0.0'): | |
|
37 | 34 | warnings.warn("""libzmq 4 detected. |
|
38 | 35 | It is unlikely that IPython's zmq code will work properly. |
|
39 | 36 | Please install libzmq stable, which is 2.1.x or 2.2.x""", |
|
40 | 37 | RuntimeWarning) |
|
41 | 38 | |
|
42 | 39 | check_for_zmq('2.1.4') |
General Comments 0
You need to be logged in to leave comments.
Login now