##// END OF EJS Templates
Moved system info into its own utility, so we can use in in test suite too.
Fernando Perez -
Show More
@@ -26,9 +26,12 b' from pprint import pformat'
26 26 # Our own
27 27 from IPython.core import release
28 28 from IPython.core import ultratb
29 from IPython.utils.genutils import sys_info
30
29 31 from IPython.external.Itpl import itpl
30 32
31 33 #****************************************************************************
34
32 35 class CrashHandler(object):
33 36 """Customizable crash handlers for IPython-based systems.
34 37
@@ -166,21 +169,13 b' $self.bug_tracker'
166 169
167 170 def make_report(self,traceback):
168 171 """Return a string containing a crash report."""
169 import platform
170 172
171 173 sec_sep = self.section_sep
172 174
173 report = []
175 report = ['*'*75+'\n\n'+'IPython post-mortem report\n\n']
174 176 rpt_add = report.append
177 rpt_add(sys_info())
175 178
176 rpt_add('*'*75+'\n\n'+'IPython post-mortem report\n\n')
177 rpt_add('IPython version: %s \n' % release.version)
178 rpt_add('BZR revision : %s \n' % release.revision)
179 rpt_add('Platform info : os.name -> %s, sys.platform -> %s\n' %
180 (os.name,sys.platform) )
181 rpt_add(' : %s\n' % platform.platform())
182 rpt_add('Python info : %s\n' % sys.version)
183
184 179 try:
185 180 config = pformat(self.app.config)
186 181 rpt_add(sec_sep+'Current user configuration structure:\n\n')
@@ -42,6 +42,7 b' else:'
42 42
43 43 # Other IPython utilities
44 44 import IPython
45 from IPython.core import release
45 46 from IPython.external.Itpl import itpl,printpl
46 47 from IPython.utils import platutils
47 48 from IPython.utils.generics import result_display
@@ -213,6 +214,31 b' def fatal(msg,exit_val=1):'
213 214
214 215 warn(msg,exit_val=exit_val,level=4)
215 216
217 def sys_info():
218 """Return useful information about IPython and the system, as a string.
219
220 Examples
221 --------
222 In [1]: print(sys_info())
223 IPython version: 0.11.bzr.r1340 # random
224 BZR revision : 1340
225 Platform info : os.name -> posix, sys.platform -> linux2
226 : Linux-2.6.31-17-generic-i686-with-Ubuntu-9.10-karmic
227 Python info : 2.6.4 (r264:75706, Dec 7 2009, 18:45:15)
228 [GCC 4.4.1]
229 """
230 import platform
231 out = []
232 out.append('IPython version: %s' % release.version)
233 out.append('BZR revision : %s' % release.revision)
234 out.append('Platform info : os.name -> %s, sys.platform -> %s' %
235 (os.name,sys.platform) )
236 out.append(' : %s' % platform.platform())
237 out.append('Python info : %s' % sys.version)
238 out.append('') # ensure closing newline
239 return '\n'.join(out)
240
241
216 242 #---------------------------------------------------------------------------
217 243 # Debugging routines
218 244 #
General Comments 0
You need to be logged in to leave comments. Login now