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