##// END OF EJS Templates
check for libedit in readline on OS X...
MinRK -
Show More
@@ -1,166 +1,169 b''
1 # encoding: utf-8
1 # encoding: utf-8
2 from __future__ import print_function
2 from __future__ import print_function
3
3
4 __docformat__ = "restructuredtext en"
4 __docformat__ = "restructuredtext en"
5
5
6 #-------------------------------------------------------------------------------
6 #-------------------------------------------------------------------------------
7 # Copyright (C) 2008 The IPython Development Team
7 # Copyright (C) 2008 The IPython Development Team
8 #
8 #
9 # Distributed under the terms of the BSD License. The full license is in
9 # Distributed under the terms of the BSD License. The full license is in
10 # the file COPYING, distributed as part of this software.
10 # the file COPYING, distributed as part of this software.
11 #-------------------------------------------------------------------------------
11 #-------------------------------------------------------------------------------
12
12
13 #-------------------------------------------------------------------------------
13 #-------------------------------------------------------------------------------
14 # Imports
14 # Imports
15 #-------------------------------------------------------------------------------
15 #-------------------------------------------------------------------------------
16
16
17 import sys, os
17 import sys, os
18 from textwrap import fill
18 from textwrap import fill
19
19
20 display_status=True
20 display_status=True
21
21
22 def check_display(f):
22 def check_display(f):
23 """decorator to allow display methods to be muted by mod.display_status"""
23 """decorator to allow display methods to be muted by mod.display_status"""
24 def maybe_display(*args, **kwargs):
24 def maybe_display(*args, **kwargs):
25 if display_status:
25 if display_status:
26 return f(*args, **kwargs)
26 return f(*args, **kwargs)
27 return maybe_display
27 return maybe_display
28
28
29 @check_display
29 @check_display
30 def print_line(char='='):
30 def print_line(char='='):
31 print(char * 76)
31 print(char * 76)
32
32
33 @check_display
33 @check_display
34 def print_status(package, status):
34 def print_status(package, status):
35 initial_indent = "%22s: " % package
35 initial_indent = "%22s: " % package
36 indent = ' ' * 24
36 indent = ' ' * 24
37 print(fill(str(status), width=76,
37 print(fill(str(status), width=76,
38 initial_indent=initial_indent,
38 initial_indent=initial_indent,
39 subsequent_indent=indent))
39 subsequent_indent=indent))
40
40
41 @check_display
41 @check_display
42 def print_message(message):
42 def print_message(message):
43 indent = ' ' * 24 + "* "
43 indent = ' ' * 24 + "* "
44 print(fill(str(message), width=76,
44 print(fill(str(message), width=76,
45 initial_indent=indent,
45 initial_indent=indent,
46 subsequent_indent=indent))
46 subsequent_indent=indent))
47
47
48 @check_display
48 @check_display
49 def print_raw(section):
49 def print_raw(section):
50 print(section)
50 print(section)
51
51
52 #-------------------------------------------------------------------------------
52 #-------------------------------------------------------------------------------
53 # Tests for specific packages
53 # Tests for specific packages
54 #-------------------------------------------------------------------------------
54 #-------------------------------------------------------------------------------
55
55
56 def check_for_ipython():
56 def check_for_ipython():
57 try:
57 try:
58 import IPython
58 import IPython
59 except ImportError:
59 except ImportError:
60 print_status("IPython", "Not found")
60 print_status("IPython", "Not found")
61 return False
61 return False
62 else:
62 else:
63 print_status("IPython", IPython.__version__)
63 print_status("IPython", IPython.__version__)
64 return True
64 return True
65
65
66 def check_for_sphinx():
66 def check_for_sphinx():
67 try:
67 try:
68 import sphinx
68 import sphinx
69 except ImportError:
69 except ImportError:
70 print_status('sphinx', "Not found (required for docs and nbconvert)")
70 print_status('sphinx', "Not found (required for docs and nbconvert)")
71 return False
71 return False
72 else:
72 else:
73 print_status('sphinx', sphinx.__version__)
73 print_status('sphinx', sphinx.__version__)
74 return True
74 return True
75
75
76 def check_for_pygments():
76 def check_for_pygments():
77 try:
77 try:
78 import pygments
78 import pygments
79 except ImportError:
79 except ImportError:
80 print_status('pygments', "Not found (required for docs and nbconvert)")
80 print_status('pygments', "Not found (required for docs and nbconvert)")
81 return False
81 return False
82 else:
82 else:
83 print_status('pygments', pygments.__version__)
83 print_status('pygments', pygments.__version__)
84 return True
84 return True
85
85
86 def check_for_jinja2():
86 def check_for_jinja2():
87 try:
87 try:
88 import jinja2
88 import jinja2
89 except ImportError:
89 except ImportError:
90 print_status('jinja2', "Not found (required for notebook and nbconvert)")
90 print_status('jinja2', "Not found (required for notebook and nbconvert)")
91 return False
91 return False
92 else:
92 else:
93 print_status('jinja2', jinja2.__version__)
93 print_status('jinja2', jinja2.__version__)
94 return True
94 return True
95
95
96 def check_for_nose():
96 def check_for_nose():
97 try:
97 try:
98 import nose
98 import nose
99 except ImportError:
99 except ImportError:
100 print_status('nose', "Not found (required for running the test suite)")
100 print_status('nose', "Not found (required for running the test suite)")
101 return False
101 return False
102 else:
102 else:
103 print_status('nose', nose.__version__)
103 print_status('nose', nose.__version__)
104 return True
104 return True
105
105
106 def check_for_pexpect():
106 def check_for_pexpect():
107 try:
107 try:
108 import pexpect
108 import pexpect
109 except ImportError:
109 except ImportError:
110 print_status("pexpect", "no (required for running standalone doctests)")
110 print_status("pexpect", "no (required for running standalone doctests)")
111 return False
111 return False
112 else:
112 else:
113 print_status("pexpect", pexpect.__version__)
113 print_status("pexpect", pexpect.__version__)
114 return True
114 return True
115
115
116 def check_for_pyzmq():
116 def check_for_pyzmq():
117 try:
117 try:
118 import zmq
118 import zmq
119 except ImportError:
119 except ImportError:
120 print_status('pyzmq', "no (required for qtconsole, notebook, and parallel computing capabilities)")
120 print_status('pyzmq', "no (required for qtconsole, notebook, and parallel computing capabilities)")
121 return False
121 return False
122 else:
122 else:
123 # pyzmq 2.1.10 adds pyzmq_version_info funtion for returning
123 # pyzmq 2.1.10 adds pyzmq_version_info funtion for returning
124 # version as a tuple
124 # version as a tuple
125 if hasattr(zmq, 'pyzmq_version_info') and zmq.pyzmq_version_info() >= (2,1,11):
125 if hasattr(zmq, 'pyzmq_version_info') and zmq.pyzmq_version_info() >= (2,1,11):
126 print_status("pyzmq", zmq.__version__)
126 print_status("pyzmq", zmq.__version__)
127 return True
127 return True
128 else:
128 else:
129 print_status('pyzmq', "no (have %s, but require >= 2.1.11 for"
129 print_status('pyzmq', "no (have %s, but require >= 2.1.11 for"
130 " qtconsole, notebook, and parallel computing capabilities)" % zmq.__version__)
130 " qtconsole, notebook, and parallel computing capabilities)" % zmq.__version__)
131 return False
131 return False
132
132
133 def check_for_tornado():
133 def check_for_tornado():
134 try:
134 try:
135 import tornado
135 import tornado
136 except ImportError:
136 except ImportError:
137 print_status('tornado', "no (required for notebook)")
137 print_status('tornado', "no (required for notebook)")
138 return False
138 return False
139 else:
139 else:
140 if getattr(tornado, 'version_info', (0,)) < (3,1):
140 if getattr(tornado, 'version_info', (0,)) < (3,1):
141 print_status('tornado', "no (have %s, but require >= 3.1.0)" % tornado.version)
141 print_status('tornado', "no (have %s, but require >= 3.1.0)" % tornado.version)
142 return False
142 return False
143 else:
143 else:
144 print_status('tornado', tornado.version)
144 print_status('tornado', tornado.version)
145 return True
145 return True
146
146
147 def check_for_readline():
147 def check_for_readline():
148 from distutils.version import LooseVersion
148 from distutils.version import LooseVersion
149 try:
149 try:
150 import readline
150 import readline
151 except ImportError:
151 except ImportError:
152 try:
152 try:
153 import pyreadline
153 import pyreadline
154 vs = pyreadline.release.version
154 vs = pyreadline.release.version
155 except (ImportError, AttributeError):
155 except (ImportError, AttributeError):
156 print_status('readline', "no (required for good interactive behavior)")
156 print_status('readline', "no (required for good interactive behavior)")
157 return False
157 return False
158 if LooseVersion(vs).version >= [1,7,1]:
158 if LooseVersion(vs).version >= [1,7,1]:
159 print_status('readline', "yes pyreadline-" + vs)
159 print_status('readline', "yes pyreadline-" + vs)
160 return True
160 return True
161 else:
161 else:
162 print_status('readline', "no pyreadline-%s < 1.7.1" % vs)
162 print_status('readline', "no pyreadline-%s < 1.7.1" % vs)
163 return False
163 return False
164 else:
164 else:
165 if sys.platform == 'darwin' and 'libedit' in readline.__doc__:
166 print_status('readline', "no (libedit detected)")
167 return False
165 print_status('readline', "yes")
168 print_status('readline', "yes")
166 return True
169 return True
General Comments 0
You need to be logged in to leave comments. Login now