##// END OF EJS Templates
move check_for_zmq to utils.zmqrelated
MinRK -
Show More
@@ -0,0 +1,47 b''
1 """utilities for checking zmq versions"""
2 #-----------------------------------------------------------------------------
3 # Copyright (C) 2013 The IPython Development Team
4 #
5 # Distributed under the terms of the BSD License. The full license is in
6 # the file COPYING.txt, distributed as part of this software.
7 #-----------------------------------------------------------------------------
8
9 #-----------------------------------------------------------------------------
10 # Verify zmq version dependency >= 2.1.11
11 #-----------------------------------------------------------------------------
12
13 import warnings
14 from IPython.utils.version import check_version
15
16
17 def patch_pyzmq():
18 """backport a few patches from newer pyzmq
19
20 These can be removed as we bump our minimum pyzmq version
21 """
22
23 import zmq
24
25 # fallback on stdlib json if jsonlib is selected, because jsonlib breaks things.
26 # jsonlib support is removed from pyzmq >= 2.2.0
27
28 from zmq.utils import jsonapi
29 if jsonapi.jsonmod.__name__ == 'jsonlib':
30 import json
31 jsonapi.jsonmod = json
32
33
34 def check_for_zmq(minimum_version, required_by='Someone'):
35 try:
36 import zmq
37 except ImportError:
38 raise ImportError("%s requires pyzmq >= %s"%(required_by, minimum_version))
39
40 patch_pyzmq()
41
42 pyzmq_version = zmq.__version__
43
44 if not check_version(pyzmq_version, minimum_version):
45 raise ImportError("%s requires pyzmq >= %s, but you have %s"%(
46 required_by, minimum_version, pyzmq_version))
47
@@ -33,8 +33,8 b' import webbrowser'
33 33
34 34
35 35 # Third party
36 # check for pyzmq 2.1.11 (this is actually redundant)
37 from IPython.kernel.zmq import check_for_zmq
36 # check for pyzmq 2.1.11
37 from IPython.utils.zmqrelated import check_for_zmq
38 38 check_for_zmq('2.1.11', 'IPython.frontend.html.notebook')
39 39
40 40 import zmq
@@ -1,5 +1,5 b''
1 1 #-----------------------------------------------------------------------------
2 # Copyright (C) 2010 The IPython Development Team
2 # Copyright (C) 2013 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.
@@ -9,41 +9,9 b''
9 9 # Verify zmq version dependency >= 2.1.11
10 10 #-----------------------------------------------------------------------------
11 11
12 import warnings
13 from IPython.utils.version import check_version
12 from IPython.utils.zmqrelated import check_for_zmq
14 13
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
24 # fallback on stdlib json if jsonlib is selected, because jsonlib breaks things.
25 # jsonlib support is removed from pyzmq >= 2.2.0
26
27 from zmq.utils import jsonapi
28 if jsonapi.jsonmod.__name__ == 'jsonlib':
29 import json
30 jsonapi.jsonmod = json
31
32
33 def check_for_zmq(minimum_version, module='IPython.kernel.zmq'):
34 try:
35 import zmq
36 except ImportError:
37 raise ImportError("%s requires pyzmq >= %s"%(module, minimum_version))
38
39 pyzmq_version = zmq.__version__
40
41 if not check_version(pyzmq_version, minimum_version):
42 raise ImportError("%s requires pyzmq >= %s, but you have %s"%(
43 module, minimum_version, pyzmq_version))
44
45 check_for_zmq('2.1.11')
46 patch_pyzmq()
14 check_for_zmq('2.1.11', 'IPython.kernel.zmq')
47 15
48 16 from .session import Session
49 17
@@ -21,7 +21,7 b' import warnings'
21 21 import zmq
22 22
23 23 from IPython.config.configurable import MultipleInstanceError
24 from IPython.kernel.zmq import check_for_zmq
24 from IPython.utils.zmqrelated import check_for_zmq
25 25
26 26 min_pyzmq = '2.1.11'
27 27
General Comments 0
You need to be logged in to leave comments. Login now