##// END OF EJS Templates
add `patch_pyzmq` for backporting a few changes from pyzmq...
MinRK -
Show More
@@ -12,6 +12,29 b''
12 import warnings
12 import warnings
13 from distutils.version import LooseVersion as V
13 from distutils.version import LooseVersion as V
14
14
15
16 def patch_pyzmq():
17 """backport a few patches from newer pyzmq
18
19 These can be removed as we bump our minimum pyzmq version
20 """
21
22 import zmq
23 # fix missing DEALER/ROUTER aliases in pyzmq < 2.1.9
24 if not hasattr(zmq, 'DEALER'):
25 zmq.DEALER = zmq.XREQ
26 if not hasattr(zmq, 'ROUTER'):
27 zmq.ROUTER = zmq.XREP
28
29 # fallback on stdlib json if jsonlib is selected, because jsonlib breaks things.
30 # jsonlib support is removed from pyzmq >= 2.2.0
31
32 from zmq.utils import jsonapi
33 if jsonapi.jsonmod.__name__ == 'jsonlib':
34 import json
35 jsonapi.jsonmod = json
36
37
15 def check_for_zmq(minimum_version, module='IPython.zmq'):
38 def check_for_zmq(minimum_version, module='IPython.zmq'):
16 try:
39 try:
17 import zmq
40 import zmq
@@ -24,12 +47,6 b" def check_for_zmq(minimum_version, module='IPython.zmq'):"
24 raise ImportError("%s requires pyzmq >= %s, but you have %s"%(
47 raise ImportError("%s requires pyzmq >= %s, but you have %s"%(
25 module, minimum_version, pyzmq_version))
48 module, minimum_version, pyzmq_version))
26
49
27 # fix missing DEALER/ROUTER aliases in pyzmq < 2.1.9
28 if not hasattr(zmq, 'DEALER'):
29 zmq.DEALER = zmq.XREQ
30 if not hasattr(zmq, 'ROUTER'):
31 zmq.ROUTER = zmq.XREP
32
33 if V(zmq.zmq_version()) >= V('4.0.0'):
50 if V(zmq.zmq_version()) >= V('4.0.0'):
34 warnings.warn("""libzmq 4 detected.
51 warnings.warn("""libzmq 4 detected.
35 It is unlikely that IPython's zmq code will work properly.
52 It is unlikely that IPython's zmq code will work properly.
@@ -37,3 +54,4 b" def check_for_zmq(minimum_version, module='IPython.zmq'):"
37 RuntimeWarning)
54 RuntimeWarning)
38
55
39 check_for_zmq('2.1.4')
56 check_for_zmq('2.1.4')
57 patch_pyzmq()
General Comments 0
You need to be logged in to leave comments. Login now