##// END OF EJS Templates
- Added patches for better pydb and Emacs support....
fperez -
Show More
@@ -15,7 +15,7 b' details on the PSF (Python Software Foundation) standard license, see:'
15 15
16 16 http://www.python.org/2.2.3/license.html
17 17
18 $Id: Debugger.py 2014 2007-01-05 10:36:58Z fperez $"""
18 $Id: Debugger.py 2154 2007-03-19 00:10:07Z fperez $"""
19 19
20 20 #*****************************************************************************
21 21 #
@@ -54,12 +54,12 b' try:'
54 54 if hasattr(pydb.pydb, "runl"):
55 55 has_pydb = True
56 56 from pydb import Pdb as OldPdb
57 prompt = 'ipydb>'
58 57 except ImportError:
59 58 pass
60 59
61 60 if has_pydb:
62 61 from pydb import Pdb as OldPdb
62 prompt = 'ipydb> '
63 63 else:
64 64 from pdb import Pdb as OldPdb
65 65
@@ -178,9 +178,10 b' class Pdb(OldPdb):'
178 178
179 179 # Parent constructor:
180 180 if has_pydb and completekey is None:
181 OldPdb.__init__(self,stdin=stdin,stdout=stdout)
181 OldPdb.__init__(self,stdin=stdin,stdout=Term.cout) #stdout)
182 182 else:
183 183 OldPdb.__init__(self,completekey,stdin,stdout)
184
184 185 self.prompt = prompt # The default prompt is '(Pdb)'
185 186
186 187 # IPython changes...
@@ -321,7 +322,7 b' class Pdb(OldPdb):'
321 322
322 323 def print_stack_entry(self,frame_lineno,prompt_prefix='\n-> ',
323 324 context = 3):
324 frame, lineno = frame_lineno
325 #frame, lineno = frame_lineno
325 326 print >>Term.cout, self.format_stack_entry(frame_lineno, '', context)
326 327
327 328 def format_stack_entry(self, frame_lineno, lprefix=': ', context = 3):
@@ -365,7 +366,11 b' class Pdb(OldPdb):'
365 366
366 367 # The level info should be generated in the same format pdb uses, to
367 368 # avoid breaking the pdbtrack functionality of python-mode in *emacs.
368 ret.append('> %s(%s)%s\n' % (link,lineno,call))
369 if frame is self.curframe:
370 ret.append('> ')
371 else:
372 ret.append(' ')
373 ret.append('%s(%s)%s\n' % (link,lineno,call))
369 374
370 375 start = lineno - 1 - context//2
371 376 lines = linecache.getlines(filename)
@@ -375,7 +380,10 b' class Pdb(OldPdb):'
375 380
376 381 for i,line in enumerate(lines):
377 382 show_arrow = (start + 1 + i == lineno)
378 ret.append(self.__format_line(tpl_line_em, filename,
383 linetpl = (frame is self.curframe or show_arrow) \
384 and tpl_line_em \
385 or tpl_line
386 ret.append(self.__format_line(linetpl, filename,
379 387 start + 1 + i, line,
380 388 arrow = show_arrow) )
381 389
@@ -18,7 +18,7 b' def call_pydb(self, args):'
18 18 argl = arg_split(args)
19 19 # print argl # dbg
20 20 if len(inspect.getargspec(pydb.runv)[0]) == 2:
21 pdb = Debugger.Pdb()
21 pdb = Debugger.Pdb(color_scheme=self.rc.colors)
22 22 ip.IP.history_saving_wrapper( lambda : pydb.runv(argl, pdb) )()
23 23 else:
24 24 ip.IP.history_saving_wrapper( lambda : pydb.runv(argl) )()
@@ -5,7 +5,7 b' General purpose utilities.'
5 5 This is a grab-bag of stuff I find useful in most programs I write. Some of
6 6 these things are also convenient when working at the command line.
7 7
8 $Id: genutils.py 2152 2007-03-18 20:13:35Z fperez $"""
8 $Id: genutils.py 2154 2007-03-19 00:10:07Z fperez $"""
9 9
10 10 #*****************************************************************************
11 11 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
@@ -68,6 +68,10 b' class IOStream:'
68 68 print >> sys.stderr, \
69 69 'ERROR - failed to write data to stream:', self.stream
70 70
71 def close(self):
72 pass
73
74
71 75 class IOTerm:
72 76 """ Term holds the file or file-like objects for handling I/O operations.
73 77
@@ -1,5 +1,12 b''
1 1 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
2 2
3 * IPython/genutils.py (IOStream.close): small patch by
4 R. Bernstein for improved pydb support.
5
6 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
7 DaveS <davls@telus.net> to improve support of debugging under
8 NTEmacs, including improved pydb behavior.
9
3 10 * IPython/Magic.py (magic_prun): Fix saving of profile info for
4 11 Python 2.5, where the stats object API changed a little. Thanks
5 12 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
@@ -6,7 +6,7 b''
6 6 ;; URL: http://ipython.scipy.org
7 7 ;; Compatibility: Emacs21, XEmacs21
8 8 ;; FIXME: #$@! INPUT RING
9 (defconst ipython-version "$Revision: 1851 $"
9 (defconst ipython-version "$Revision: 2154 $"
10 10 "VC version number.")
11 11
12 12 ;;; Commentary
@@ -195,12 +195,13 b' the second for a \'normal\' command, and the third for a multiline command.")'
195 195 ;;^ File \"\\(.*?\\)\", line \\([0-9]+\\)"
196 196
197 197 (setq py-traceback-line-re
198 "\\(^[^\t ].+?\\.py\\).*\n +[0-9]+[^\00]*?\n-+> \\([0-9]+\\) +")
198 "\\(^[^\t >].+?\\.py\\).*\n +[0-9]+[^\00]*?\n-+> \\([0-9]+\\)+")
199
199 200
200 201 ;; Recognize the ipython pdb, whose prompt is 'ipdb>' or 'ipydb>'
201 202 ;;instead of '(Pdb)'
202 203 (setq py-pdbtrack-input-prompt "\n[(<]*[Ii]?[Pp]y?db[>)]+ ")
203 (setq py-pydbtrack-input-prompt "\n[(]*ipydb[>)]+ ")
204 (setq pydb-pydbtrack-input-prompt "\n[(]*ipydb[>)]+ ")
204 205
205 206 (setq py-shell-input-prompt-1-regexp "^In \\[[0-9]+\\]: *"
206 207 py-shell-input-prompt-2-regexp "^ [.][.][.]+: *" )
@@ -1176,7 +1176,7 b' PyWin32'
1176 1176 PyWin32
1177 1177 \family default
1178 1178 from
1179 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/mhammond}
1179 \begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/pywin32}
1180 1180
1181 1181 \end_inset
1182 1182
@@ -1186,33 +1186,39 b' PyWin32'
1186 1186 \begin_layout Enumerate
1187 1187
1188 1188 \family typewriter
1189 CTypes
1189 PyReadline
1190 1190 \family default
1191 from
1192 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/theller/ctypes}
1191 for Windows from
1192 \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org/moin/PyReadline/Intro}
1193 1193
1194 1194 \end_inset
1195 1195
1196 (you
1197 \emph on
1198 must
1199 \emph default
1200 use version 0.9.1 or newer).
1196 .
1197 That page contains further details on using and configuring the system
1198 to your liking.
1201 1199 \end_layout
1202 1200
1203 1201 \begin_layout Enumerate
1204
1202 Finally,
1203 \emph on
1204 only
1205 \emph default
1206 if you are using Python 2.3 or 2.4, you need
1205 1207 \family typewriter
1206 PyReadline
1208 CTypes
1207 1209 \family default
1208 for Windows from
1209 \begin_inset LatexCommand \htmlurl{http://projects.scipy.org/ipython/ipython/wiki/PyReadline/Intro}
1210 from
1211 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/theller/ctypes}
1210 1212
1211 1213 \end_inset
1212 1214
1213 .
1214 That page contains further details on using and configuring the system
1215 to your liking.
1215 (you
1216 \emph on
1217 must
1218 \emph default
1219 use version 0.9.1 or newer).
1220 This package is included in Python 2.5, so you don't need to manually get
1221 it if your Python version is 2.5 or newer.
1216 1222 \end_layout
1217 1223
1218 1224 \begin_layout Standard
General Comments 0
You need to be logged in to leave comments. Login now