##// END OF EJS Templates
Simple change to add svn revision info at the top level and crash handler....
fperez -
Show More
@@ -1,109 +1,110 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """sys.excepthook for IPython itself, leaves a detailed report on disk.
2 """sys.excepthook for IPython itself, leaves a detailed report on disk.
3
3
4 $Id: CrashHandler.py 410 2004-11-04 07:58:17Z fperez $"""
4 $Id: CrashHandler.py 775 2005-09-01 20:24:59Z fperez $"""
5
5
6 #*****************************************************************************
6 #*****************************************************************************
7 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
7 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
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 from IPython import Release
13 from IPython import Release
14 __author__ = '%s <%s>' % Release.authors['Fernando']
14 __author__ = '%s <%s>' % Release.authors['Fernando']
15 __license__ = Release.license
15 __license__ = Release.license
16 __version__ = Release.version
16 __version__ = Release.version
17
17
18 #****************************************************************************
18 #****************************************************************************
19 # Required modules
19 # Required modules
20
20
21 # From the standard library
21 # From the standard library
22 import os,sys
22 import os,sys
23 from pprint import pprint,pformat
23 from pprint import pprint,pformat
24
24
25 # Homebrewed
25 # Homebrewed
26 from IPython.genutils import *
26 from IPython.genutils import *
27 from IPython.Itpl import Itpl,itpl,printpl
27 from IPython.Itpl import Itpl,itpl,printpl
28 from IPython import ultraTB
28 from IPython import ultraTB
29 from IPython.ultraTB import ColorScheme,ColorSchemeTable # too long names
29 from IPython.ultraTB import ColorScheme,ColorSchemeTable # too long names
30
30
31 #****************************************************************************
31 #****************************************************************************
32 class CrashHandler:
32 class CrashHandler:
33 """sys.excepthook for IPython itself, leaves a detailed report on disk."""
33 """sys.excepthook for IPython itself, leaves a detailed report on disk."""
34
34
35 def __init__(self,IP):
35 def __init__(self,IP):
36 self.IP = IP # IPython instance
36 self.IP = IP # IPython instance
37 self.bug_contact = Release.authors['Fernando'][0]
37 self.bug_contact = Release.authors['Fernando'][0]
38 self.mailto = Release.authors['Fernando'][1]
38 self.mailto = Release.authors['Fernando'][1]
39
39
40 def __call__(self,etype, evalue, etb):
40 def __call__(self,etype, evalue, etb):
41
41
42 # Report tracebacks shouldn't use color in general (safer for users)
42 # Report tracebacks shouldn't use color in general (safer for users)
43 color_scheme = 'NoColor'
43 color_scheme = 'NoColor'
44
44
45 # Use this ONLY for developer debugging (keep commented out for release)
45 # Use this ONLY for developer debugging (keep commented out for release)
46 #color_scheme = 'Linux' # dbg
46 #color_scheme = 'Linux' # dbg
47
47
48 try:
48 try:
49 rptdir = self.IP.rc.ipythondir
49 rptdir = self.IP.rc.ipythondir
50 except:
50 except:
51 rptdir = os.getcwd()
51 rptdir = os.getcwd()
52 if not os.path.isdir(rptdir):
52 if not os.path.isdir(rptdir):
53 rptdir = os.getcwd()
53 rptdir = os.getcwd()
54 self.report_name = os.path.join(rptdir,'IPython_crash_report.txt')
54 self.report_name = os.path.join(rptdir,'IPython_crash_report.txt')
55 self.TBhandler = ultraTB.VerboseTB(color_scheme=color_scheme,long_header=1)
55 self.TBhandler = ultraTB.VerboseTB(color_scheme=color_scheme,long_header=1)
56 traceback = self.TBhandler.text(etype,evalue,etb,context=31)
56 traceback = self.TBhandler.text(etype,evalue,etb,context=31)
57
57
58 # print traceback to screen
58 # print traceback to screen
59 print >> sys.stderr, traceback
59 print >> sys.stderr, traceback
60
60
61 # and generate a complete report on disk
61 # and generate a complete report on disk
62 try:
62 try:
63 report = open(self.report_name,'w')
63 report = open(self.report_name,'w')
64 except:
64 except:
65 print >> sys.stderr, 'Could not create crash report on disk.'
65 print >> sys.stderr, 'Could not create crash report on disk.'
66 return
66 return
67
67
68 msg = itpl('\n'+'*'*70+'\n'
68 msg = itpl('\n'+'*'*70+'\n'
69 """
69 """
70 Oops, IPython crashed. We do our best to make it stable, but...
70 Oops, IPython crashed. We do our best to make it stable, but...
71
71
72 A crash report was automatically generated with the following information:
72 A crash report was automatically generated with the following information:
73 - A verbatim copy of the traceback above this text.
73 - A verbatim copy of the traceback above this text.
74 - A copy of your input history during this session.
74 - A copy of your input history during this session.
75 - Data on your current IPython configuration.
75 - Data on your current IPython configuration.
76
76
77 It was left in the file named:
77 It was left in the file named:
78 \t'$self.report_name'
78 \t'$self.report_name'
79 If you can email this file to the developers, the information in it will help
79 If you can email this file to the developers, the information in it will help
80 them in understanding and correcting the problem.
80 them in understanding and correcting the problem.
81
81
82 You can mail it to $self.bug_contact at $self.mailto
82 You can mail it to $self.bug_contact at $self.mailto
83 with the subject 'IPython Crash Report'.
83 with the subject 'IPython Crash Report'.
84
84
85 If you want to do it now, the following command will work (under Unix):
85 If you want to do it now, the following command will work (under Unix):
86 mail -s 'IPython Crash Report' $self.mailto < $self.report_name
86 mail -s 'IPython Crash Report' $self.mailto < $self.report_name
87
87
88 To ensure accurate tracking of this issue, please file a report about it at:
88 To ensure accurate tracking of this issue, please file a report about it at:
89 http://www.scipy.net/roundup/ipython (IPython's online bug tracker).
89 http://www.scipy.net/roundup/ipython (IPython's online bug tracker).
90 """)
90 """)
91 print >> sys.stderr, msg
91 print >> sys.stderr, msg
92
92
93 sec_sep = '\n\n'+'*'*75+'\n\n'
93 sec_sep = '\n\n'+'*'*75+'\n\n'
94 report.write('*'*75+'\n\n'+'IPython post-mortem report\n\n')
94 report.write('*'*75+'\n\n'+'IPython post-mortem report\n\n')
95 report.write('IPython version: %s \n\n' % __version__)
95 report.write('IPython version: %s \n\n' % Release.version)
96 report.write('SVN revision : %s \n\n' % Release.revision)
96 report.write('Platform info : os.name -> %s, sys.platform -> %s' %
97 report.write('Platform info : os.name -> %s, sys.platform -> %s' %
97 (os.name,sys.platform) )
98 (os.name,sys.platform) )
98 report.write(sec_sep+'Current user configuration structure:\n\n')
99 report.write(sec_sep+'Current user configuration structure:\n\n')
99 report.write(pformat(self.IP.rc.dict()))
100 report.write(pformat(self.IP.rc.dict()))
100 report.write(sec_sep+'Crash traceback:\n\n' + traceback)
101 report.write(sec_sep+'Crash traceback:\n\n' + traceback)
101 try:
102 try:
102 report.write(sec_sep+"History of session input:")
103 report.write(sec_sep+"History of session input:")
103 for line in self.IP.user_ns['_ih']:
104 for line in self.IP.user_ns['_ih']:
104 report.write(line)
105 report.write(line)
105 report.write('\n*** Last line of input (may not be in above history):\n')
106 report.write('\n*** Last line of input (may not be in above history):\n')
106 report.write(self.IP._last_input_line+'\n')
107 report.write(self.IP._last_input_line+'\n')
107 except:
108 except:
108 pass
109 pass
109 report.close()
110 report.close()
@@ -1,72 +1,74 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Release data for the IPython project.
2 """Release data for the IPython project.
3
3
4 $Id: Release.py 750 2005-08-24 17:36:16Z fperez $"""
4 $Id: Release.py 775 2005-09-01 20:24:59Z fperez $"""
5
5
6 #*****************************************************************************
6 #*****************************************************************************
7 # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu>
7 # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu>
8 #
8 #
9 # Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and Nathaniel Gray
9 # Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and Nathaniel Gray
10 # <n8gray@caltech.edu>
10 # <n8gray@caltech.edu>
11 #
11 #
12 # Distributed under the terms of the BSD License. The full license is in
12 # Distributed under the terms of the BSD License. The full license is in
13 # the file COPYING, distributed as part of this software.
13 # the file COPYING, distributed as part of this software.
14 #*****************************************************************************
14 #*****************************************************************************
15
15
16 # Name of the package for release purposes. This is the name which labels
16 # Name of the package for release purposes. This is the name which labels
17 # the tarballs and RPMs made by distutils, so it's best to lowercase it.
17 # the tarballs and RPMs made by distutils, so it's best to lowercase it.
18 name = 'ipython'
18 name = 'ipython'
19
19
20 # For versions with substrings (like 0.6.16.svn), use an extra . to separate
20 # For versions with substrings (like 0.6.16.svn), use an extra . to separate
21 # the new substring. We have to avoid using either dashes or underscores,
21 # the new substring. We have to avoid using either dashes or underscores,
22 # because bdist_rpm does not accept dashes (an RPM) convention, and
22 # because bdist_rpm does not accept dashes (an RPM) convention, and
23 # bdist_deb does not accept underscores (a Debian convention).
23 # bdist_deb does not accept underscores (a Debian convention).
24
24
25 version = '0.6.16.svn'
25 version = '0.6.16.svn'
26
26
27 revision = '$Revision: 775 $'
28
27 description = "An enhanced interactive Python shell."
29 description = "An enhanced interactive Python shell."
28
30
29 long_description = \
31 long_description = \
30 """
32 """
31 IPython provides a replacement for the interactive Python interpreter with
33 IPython provides a replacement for the interactive Python interpreter with
32 extra functionality.
34 extra functionality.
33
35
34 Main features:
36 Main features:
35
37
36 * Comprehensive object introspection.
38 * Comprehensive object introspection.
37
39
38 * Input history, persistent across sessions.
40 * Input history, persistent across sessions.
39
41
40 * Caching of output results during a session with automatically generated
42 * Caching of output results during a session with automatically generated
41 references.
43 references.
42
44
43 * Readline based name completion.
45 * Readline based name completion.
44
46
45 * Extensible system of 'magic' commands for controlling the environment and
47 * Extensible system of 'magic' commands for controlling the environment and
46 performing many tasks related either to IPython or the operating system.
48 performing many tasks related either to IPython or the operating system.
47
49
48 * Configuration system with easy switching between different setups (simpler
50 * Configuration system with easy switching between different setups (simpler
49 than changing $PYTHONSTARTUP environment variables every time).
51 than changing $PYTHONSTARTUP environment variables every time).
50
52
51 * Session logging and reloading.
53 * Session logging and reloading.
52
54
53 * Extensible syntax processing for special purpose situations.
55 * Extensible syntax processing for special purpose situations.
54
56
55 * Access to the system shell with user-extensible alias system.
57 * Access to the system shell with user-extensible alias system.
56
58
57 * Easily embeddable in other Python programs.
59 * Easily embeddable in other Python programs.
58
60
59 * Integrated access to the pdb debugger and the Python profiler. """
61 * Integrated access to the pdb debugger and the Python profiler. """
60
62
61 license = 'BSD'
63 license = 'BSD'
62
64
63 authors = {'Fernando' : ('Fernando Perez','fperez@colorado.edu'),
65 authors = {'Fernando' : ('Fernando Perez','fperez@colorado.edu'),
64 'Janko' : ('Janko Hauser','jhauser@zscout.de'),
66 'Janko' : ('Janko Hauser','jhauser@zscout.de'),
65 'Nathan' : ('Nathaniel Gray','n8gray@caltech.edu')
67 'Nathan' : ('Nathaniel Gray','n8gray@caltech.edu')
66 }
68 }
67
69
68 url = 'http://ipython.scipy.org'
70 url = 'http://ipython.scipy.org'
69
71
70 platforms = ['Linux','Mac OSX','Windows XP/2000/NT','Windows 95/98/ME']
72 platforms = ['Linux','Mac OSX','Windows XP/2000/NT','Windows 95/98/ME']
71
73
72 keywords = ['Interactive','Interpreter','Shell']
74 keywords = ['Interactive','Interpreter','Shell']
@@ -1,63 +1,64 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 IPython -- An enhanced Interactive Python
3 IPython -- An enhanced Interactive Python
4
4
5 One of Python's nicest features is its interactive interpreter. This allows
5 One of Python's nicest features is its interactive interpreter. This allows
6 very fast testing of ideas without the overhead of creating test files as is
6 very fast testing of ideas without the overhead of creating test files as is
7 typical in most programming languages. However, the interpreter supplied with
7 typical in most programming languages. However, the interpreter supplied with
8 the standard Python distribution is fairly primitive (and IDLE isn't really
8 the standard Python distribution is fairly primitive (and IDLE isn't really
9 much better).
9 much better).
10
10
11 IPython tries to:
11 IPython tries to:
12
12
13 i - provide an efficient environment for interactive work in Python
13 i - provide an efficient environment for interactive work in Python
14 programming. It tries to address what we see as shortcomings of the standard
14 programming. It tries to address what we see as shortcomings of the standard
15 Python prompt, and adds many features to make interactive work much more
15 Python prompt, and adds many features to make interactive work much more
16 efficient.
16 efficient.
17
17
18 ii - offer a flexible framework so that it can be used as the base
18 ii - offer a flexible framework so that it can be used as the base
19 environment for other projects and problems where Python can be the
19 environment for other projects and problems where Python can be the
20 underlying language. Specifically scientific environments like Mathematica,
20 underlying language. Specifically scientific environments like Mathematica,
21 IDL and Mathcad inspired its design, but similar ideas can be useful in many
21 IDL and Mathcad inspired its design, but similar ideas can be useful in many
22 fields. Python is a fabulous language for implementing this kind of system
22 fields. Python is a fabulous language for implementing this kind of system
23 (due to its dynamic and introspective features), and with suitable libraries
23 (due to its dynamic and introspective features), and with suitable libraries
24 entire systems could be built leveraging Python's power.
24 entire systems could be built leveraging Python's power.
25
25
26 iii - serve as an embeddable, ready to go interpreter for your own programs.
26 iii - serve as an embeddable, ready to go interpreter for your own programs.
27
27
28 IPython requires Python 2.2 or newer.
28 IPython requires Python 2.2 or newer.
29
29
30 $Id: __init__.py 530 2005-03-02 07:11:15Z fperez $"""
30 $Id: __init__.py 775 2005-09-01 20:24:59Z fperez $"""
31
31
32 #*****************************************************************************
32 #*****************************************************************************
33 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
33 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
34 #
34 #
35 # Distributed under the terms of the BSD License. The full license is in
35 # Distributed under the terms of the BSD License. The full license is in
36 # the file COPYING, distributed as part of this software.
36 # the file COPYING, distributed as part of this software.
37 #*****************************************************************************
37 #*****************************************************************************
38
38
39 # Enforce proper version requirements
39 # Enforce proper version requirements
40 import sys
40 import sys
41 if sys.version[0:3] < '2.2':
41 if sys.version[0:3] < '2.2':
42 raise ImportError, 'Python Version 2.2 or above is required.'
42 raise ImportError, 'Python Version 2.2 or above is required.'
43
43
44 # Define what gets imported with a 'from IPython import *'
44 # Define what gets imported with a 'from IPython import *'
45 __all__ = ['deep_reload','genutils','ultraTB','DPyGetOpt','Itpl','hooks',
45 __all__ = ['deep_reload','genutils','ultraTB','DPyGetOpt','Itpl','hooks',
46 'ConfigLoader','OutputTrap','Release','Struct','Shell']
46 'ConfigLoader','OutputTrap','Release','Struct','Shell']
47
47
48 # Load __all__ in IPython namespace so that a simple 'import IPython' gives
48 # Load __all__ in IPython namespace so that a simple 'import IPython' gives
49 # access to them via IPython.<name>
49 # access to them via IPython.<name>
50 glob,loc = globals(),locals()
50 glob,loc = globals(),locals()
51 for name in __all__:
51 for name in __all__:
52 __import__(name,glob,loc,[])
52 __import__(name,glob,loc,[])
53
53
54 # Release data
54 # Release data
55 from IPython import Release # do it explicitly so pydoc can see it - pydoc bug
55 from IPython import Release # do it explicitly so pydoc can see it - pydoc bug
56 __author__ = '%s <%s>\n%s <%s>\n%s <%s>' % \
56 __author__ = '%s <%s>\n%s <%s>\n%s <%s>' % \
57 ( Release.authors['Fernando'] + Release.authors['Janko'] + \
57 ( Release.authors['Fernando'] + Release.authors['Janko'] + \
58 Release.authors['Nathan'] )
58 Release.authors['Nathan'] )
59 __license__ = Release.license
59 __license__ = Release.license
60 __version__ = Release.version
60 __version__ = Release.version
61 __revision__ = Release.revision
61
62
62 # Namespace cleanup
63 # Namespace cleanup
63 del name,glob,loc
64 del name,glob,loc
General Comments 0
You need to be logged in to leave comments. Login now