Show More
@@ -9,21 +9,18 b'' | |||||
9 | # Verify zmq version dependency >= 2.1.4 |
|
9 | # Verify zmq version dependency >= 2.1.4 | |
10 | #----------------------------------------------------------------------------- |
|
10 | #----------------------------------------------------------------------------- | |
11 |
|
11 | |||
12 | import re |
|
|||
13 | import warnings |
|
12 | import warnings | |
|
13 | from pkg_resources import parse_version as V | |||
14 |
|
14 | |||
15 | def check_for_zmq(minimum_version, module='IPython.zmq'): |
|
15 | def check_for_zmq(minimum_version, module='IPython.zmq'): | |
16 | min_vlist = [int(n) for n in minimum_version.split('.')] |
|
|||
17 |
|
||||
18 | try: |
|
16 | try: | |
19 | import zmq |
|
17 | import zmq | |
20 | except ImportError: |
|
18 | except ImportError: | |
21 | raise ImportError("%s requires pyzmq >= %s"%(module, minimum_version)) |
|
19 | raise ImportError("%s requires pyzmq >= %s"%(module, minimum_version)) | |
22 |
|
20 | |||
23 | pyzmq_version = zmq.__version__ |
|
21 | pyzmq_version = zmq.__version__ | |
24 | vlist = [int(n) for n in re.findall(r'\d+', pyzmq_version)] |
|
|||
25 |
|
22 | |||
26 | if 'dev' not in pyzmq_version and vlist < min_vlist: |
|
23 | if V(pyzmq_version) < V(minimum_version): | |
27 | raise ImportError("%s requires pyzmq >= %s, but you have %s"%( |
|
24 | raise ImportError("%s requires pyzmq >= %s, but you have %s"%( | |
28 | module, minimum_version, pyzmq_version)) |
|
25 | module, minimum_version, pyzmq_version)) | |
29 |
|
26 | |||
@@ -33,7 +30,7 b" def check_for_zmq(minimum_version, module='IPython.zmq'):" | |||||
33 | if not hasattr(zmq, 'ROUTER'): |
|
30 | if not hasattr(zmq, 'ROUTER'): | |
34 | zmq.ROUTER = zmq.XREP |
|
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 | warnings.warn("""libzmq 4 detected. |
|
34 | warnings.warn("""libzmq 4 detected. | |
38 | It is unlikely that IPython's zmq code will work properly. |
|
35 | It is unlikely that IPython's zmq code will work properly. | |
39 | Please install libzmq stable, which is 2.1.x or 2.2.x""", |
|
36 | Please install libzmq stable, which is 2.1.x or 2.2.x""", |
General Comments 0
You need to be logged in to leave comments.
Login now