Show More
@@ -1,39 +1,39 | |||||
1 | #----------------------------------------------------------------------------- |
|
1 | #----------------------------------------------------------------------------- | |
2 | # Copyright (C) 2010 The IPython Development Team |
|
2 | # Copyright (C) 2010 The IPython Development Team | |
3 | # |
|
3 | # | |
4 | # Distributed under the terms of the BSD License. The full license is in |
|
4 | # Distributed under the terms of the BSD License. The full license is in | |
5 | # the file COPYING.txt, distributed as part of this software. |
|
5 | # the file COPYING.txt, distributed as part of this software. | |
6 | #----------------------------------------------------------------------------- |
|
6 | #----------------------------------------------------------------------------- | |
7 |
|
7 | |||
8 | #----------------------------------------------------------------------------- |
|
8 | #----------------------------------------------------------------------------- | |
9 | # Verify zmq version dependency >= 2.1.4 |
|
9 | # Verify zmq version dependency >= 2.1.4 | |
10 | #----------------------------------------------------------------------------- |
|
10 | #----------------------------------------------------------------------------- | |
11 |
|
11 | |||
12 | import warnings |
|
12 | import warnings | |
13 |
from |
|
13 | from distutils.version import LooseVersion 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 | try: |
|
16 | try: | |
17 | import zmq |
|
17 | import zmq | |
18 | except ImportError: |
|
18 | except ImportError: | |
19 | raise ImportError("%s requires pyzmq >= %s"%(module, minimum_version)) |
|
19 | raise ImportError("%s requires pyzmq >= %s"%(module, minimum_version)) | |
20 |
|
20 | |||
21 | pyzmq_version = zmq.__version__ |
|
21 | pyzmq_version = zmq.__version__ | |
22 |
|
22 | |||
23 | if V(pyzmq_version) < V(minimum_version): |
|
23 | if V(pyzmq_version) < V(minimum_version): | |
24 | raise ImportError("%s requires pyzmq >= %s, but you have %s"%( |
|
24 | raise ImportError("%s requires pyzmq >= %s, but you have %s"%( | |
25 | module, minimum_version, pyzmq_version)) |
|
25 | module, minimum_version, pyzmq_version)) | |
26 |
|
26 | |||
27 | # fix missing DEALER/ROUTER aliases in pyzmq < 2.1.9 |
|
27 | # fix missing DEALER/ROUTER aliases in pyzmq < 2.1.9 | |
28 | if not hasattr(zmq, 'DEALER'): |
|
28 | if not hasattr(zmq, 'DEALER'): | |
29 | zmq.DEALER = zmq.XREQ |
|
29 | zmq.DEALER = zmq.XREQ | |
30 | if not hasattr(zmq, 'ROUTER'): |
|
30 | if not hasattr(zmq, 'ROUTER'): | |
31 | zmq.ROUTER = zmq.XREP |
|
31 | zmq.ROUTER = zmq.XREP | |
32 |
|
32 | |||
33 | if V(zmq.zmq_version()) >= V('4.0.0'): |
|
33 | if V(zmq.zmq_version()) >= V('4.0.0'): | |
34 | warnings.warn("""libzmq 4 detected. |
|
34 | warnings.warn("""libzmq 4 detected. | |
35 | It is unlikely that IPython's zmq code will work properly. |
|
35 | It is unlikely that IPython's zmq code will work properly. | |
36 | 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""", | |
37 | RuntimeWarning) |
|
37 | RuntimeWarning) | |
38 |
|
38 | |||
39 | check_for_zmq('2.1.4') |
|
39 | check_for_zmq('2.1.4') |
General Comments 0
You need to be logged in to leave comments.
Login now