##// END OF EJS Templates
Merged 1071-1076 from banches/0.7.1
 vivainio - Tue, 24 Jan 2006 18:15:27
r145:e78b53f4
 @@ -2,7 +2,7 2 """ 2 """ 3 Logger class for IPython's logging facilities. 3 Logger class for IPython's logging facilities. 4 4 5 $Id: Logger.py 994 2006-01-08 08:29:44Z fperez$ 5 $Id: Logger.py 1077 2006-01-24 18:15:27Z vivainio$ 6 """ 6 """ 7 7 8 #***************************************************************************** 8 #***************************************************************************** @@ -214,6 +214,7 which already exists. But you must first start the logging process with 214 def log_write(self,data,kind='input'): 214 def log_write(self,data,kind='input'): 215 """Write data to the log file, if active""" 215 """Write data to the log file, if active""" 216 216 217 #print 'data: %r' % data # dbg 217 if self.log_active and data: 218 if self.log_active and data: 218 write = self.logfile.write 219 write = self.logfile.write 219 if kind=='input': 220 if kind=='input':
 @@ -1,7 +1,7 1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*- 2 """Magic functions for InteractiveShell. 2 """Magic functions for InteractiveShell. 3 3 4 $Id: Magic.py 1076 2006-01-24 17:27:05Z vivainio$""" 4 $Id: Magic.py 1077 2006-01-24 18:15:27Z vivainio$""" 5 5 6 #***************************************************************************** 6 #***************************************************************************** 7 # Copyright (C) 2001 Janko Hauser and 7 # Copyright (C) 2001 Janko Hauser and @@ -480,27 +480,42 Currently the magic system has the following functions:\n""" 480 def magic_history(self, parameter_s = ''): 480 def magic_history(self, parameter_s = ''): 481 """Print input history (_i variables), with most recent last. 481 """Print input history (_i variables), with most recent last. 482 482 483 %history [-n] -> print at most 40 inputs (some may be multi-line)\\ 483 %history -> print at most 40 inputs (some may be multi-line)\\ 484 %history [-n] n -> print at most n inputs\\ 484 %history n -> print at most n inputs\\ 485 %history [-n] n1 n2 -> print inputs between n1 and n2 (n2 not included)\\ 485 %history n1 n2 -> print inputs between n1 and n2 (n2 not included)\\ 486 486 487 Each input's number is shown, and is accessible as the 487 Each input's number is shown, and is accessible as the 488 automatically generated variable _i. Multi-line statements are 488 automatically generated variable _i. Multi-line statements are 489 printed starting at a new line for easy copy/paste. 489 printed starting at a new line for easy copy/paste. 490 491 492 Options: 490 493 491 If option -n is used, input numbers are not printed. This is useful if 494 -n: do NOT print line numbers. This is useful if you want to get a 492 you want to get a printout of many lines which can be directly pasted 495 printout of many lines which can be directly pasted into a text 493 into a text editor. 496 editor. 494 497 495 This feature is only available if numbered prompts are in use.""" 498 This feature is only available if numbered prompts are in use. 499 500 -r: print the 'raw' history. IPython filters your input and 501 converts it all into valid Python source before executing it (things 502 like magics or aliases are turned into function calls, for 503 example). With this option, you'll see the unfiltered history 504 instead of the filtered version: '%cd /' will be seen as '%cd /' 505 instead of 'ipmagic("%cd /")'. 506 """ 496 507 497 shell = self.shell 508 shell = self.shell 498 if not shell.outputcache.do_full_cache: 509 if not shell.outputcache.do_full_cache: 499 print 'This feature is only available if numbered prompts are in use.' 510 print 'This feature is only available if numbered prompts are in use.' 500 return 511 return 501 opts,args = self.parse_options(parameter_s,'n',mode='list') 512 opts,args = self.parse_options(parameter_s,'nr',mode='list') 513 514 if opts.has_key('r'): 515 input_hist = shell.input_hist_raw 516 else: 517 input_hist = shell.input_hist 502 518 503 input_hist = shell.input_hist 504 default_length = 40 519 default_length = 40 505 if len(args) == 0: 520 if len(args) == 0: 506 final = len(input_hist) 521 final = len(input_hist)
 @@ -1,7 +1,7 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 1058 2006-01-22 14:30:01Z vivainio$""" 4 $Id: Release.py 1077 2006-01-24 18:15:27Z vivainio$""" 5 5 6 #***************************************************************************** 6 #***************************************************************************** 7 # Copyright (C) 2001-2006 Fernando Perez 7 # Copyright (C) 2001-2006 Fernando Perez @@ -22,9 +22,10 name = 'ipython' 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 25 version = '0.7.2.svn' 26 version = '0.7.2.svn' 26 27 27 revision = '$Revision: 1058$' 28 revision = '$Revision: 1077$' 28 29 29 description = "An enhanced interactive Python shell." 30 description = "An enhanced interactive Python shell." 30 31
 @@ -5,7 +5,7 General purpose utilities. 5 This is a grab-bag of stuff I find useful in most programs I write. Some of 5 This is a grab-bag of stuff I find useful in most programs I write. Some of 6 these things are also convenient when working at the command line. 6 these things are also convenient when working at the command line. 7 7 8 $Id: genutils.py 1058 2006-01-22 14:30:01Z vivainio$""" 8 $Id: genutils.py 1077 2006-01-24 18:15:27Z vivainio$""" 9 9 10 #***************************************************************************** 10 #***************************************************************************** 11 # Copyright (C) 2001-2006 Fernando Perez. 11 # Copyright (C) 2001-2006 Fernando Perez. @@ -207,9 +207,10 def fatal(msg,exit_val=1): 207 207 208 warn(msg,exit_val=exit_val,level=4) 208 warn(msg,exit_val=exit_val,level=4) 209 209 210 210 #--------------------------------------------------------------------------- 211 # useful for debugging 211 # Debugging routines 212 def debugp(expr,pre_msg=''): 212 # 213 def debugx(expr,pre_msg=''): 213 """Print the value of an expression from the caller's frame. 214 """Print the value of an expression from the caller's frame. 214 215 215 Takes an expression, evaluates it in the caller's frame and prints both 216 Takes an expression, evaluates it in the caller's frame and prints both @@ -225,7 +226,7 def debugp(expr,pre_msg=''): 225 eval(expr,cf.f_globals,cf.f_locals)) 226 eval(expr,cf.f_globals,cf.f_locals)) 226 227 227 # deactivate it by uncommenting the following line, which makes it a no-op 228 # deactivate it by uncommenting the following line, which makes it a no-op 228 def debugp(expr,pre_msg=''): pass 229 #def debugx(expr,pre_msg=''): pass 229 230 230 #---------------------------------------------------------------------------- 231 #---------------------------------------------------------------------------- 231 StringTypes = types.StringTypes 232 StringTypes = types.StringTypes
 @@ -6,7 +6,7 Requires Python 2.3 or newer. 6 6 7 This file contains all the classes and helper functions specific to IPython. 7 This file contains all the classes and helper functions specific to IPython. 8 8 9 $Id: iplib.py 1058 2006-01-22 14:30:01Z vivainio$ 9 $Id: iplib.py 1077 2006-01-24 18:15:27Z vivainio$ 10 """ 10 """ 11 11 12 #***************************************************************************** 12 #***************************************************************************** @@ -341,6 +341,10 class InteractiveShell(object,Magic): 341 # List of input with multi-line handling. 341 # List of input with multi-line handling. 342 # Fill its zero entry, user counter starts at 1 342 # Fill its zero entry, user counter starts at 1 343 self.input_hist = InputList(['\n']) 343 self.input_hist = InputList(['\n']) 344 # This one will hold the 'raw' input history, without any 345 # pre-processing. This will allow users to retrieve the input just as 346 # it was exactly typed in by the user, with %hist -r. 347 self.input_hist_raw = InputList(['\n']) 344 348 345 # list of visited directories 349 # list of visited directories 346 try: 350 try: @@ -1155,7 +1159,7 want to merge them back into the new files.""" % locals() 1155 1159 1156 Currently it handles auto-indent only.""" 1160 Currently it handles auto-indent only.""" 1157 1161 1158 #debugp('self.indent_current_nsp','pre_readline:') 1162 #debugx('self.indent_current_nsp','pre_readline:') 1159 self.readline.insert_text(self.indent_current_str()) 1163 self.readline.insert_text(self.indent_current_str()) 1160 1164 1161 def init_readline(self): 1165 def init_readline(self): @@ -1554,9 +1558,8 want to merge them back into the new files.""" % locals() 1554 def autoindent_update(self,line): 1558 def autoindent_update(self,line): 1555 """Keep track of the indent level.""" 1559 """Keep track of the indent level.""" 1556 1560 1557 #import traceback; traceback.print_stack() # dbg 1561 #debugx('line') 1558 debugp('line') 1562 #debugx('self.indent_current_nsp') 1559 debugp('self.indent_current_nsp') 1560 if self.autoindent: 1563 if self.autoindent: 1561 if line: 1564 if line: 1562 inisp = num_ini_spaces(line) 1565 inisp = num_ini_spaces(line) @@ -1755,19 +1758,22 want to merge them back into the new files.""" % locals() 1755 # Try to be reasonably smart about not re-indenting pasted input more 1758 # Try to be reasonably smart about not re-indenting pasted input more 1756 # than necessary. We do this by trimming out the auto-indent initial 1759 # than necessary. We do this by trimming out the auto-indent initial 1757 # spaces, if the user's actual input started itself with whitespace. 1760 # spaces, if the user's actual input started itself with whitespace. 1758 #debugp('self.buffer[-1]') 1761 #debugx('self.buffer[-1]') 1759 1762 1760 debugp('line') 1761 debugp('self.indent_current_nsp') 1762 if self.autoindent: 1763 if self.autoindent: 1763 if num_ini_spaces(line) > self.indent_current_nsp: 1764 if num_ini_spaces(line) > self.indent_current_nsp: 1764 line = line[self.indent_current_nsp:] 1765 line = line[self.indent_current_nsp:] 1765 self.indent_current_nsp = 0 1766 self.indent_current_nsp = 0 1766 debugp('self.indent_current_nsp') 1767 1767 1768 debugp('line') 1768 # store the unfiltered input before the user has any chance to modify 1769 # it. 1770 if line.strip(): 1771 if continue_prompt: 1772 self.input_hist_raw[-1] += '%s\n' % line 1773 else: 1774 self.input_hist_raw.append('%s\n' % line) 1775 1769 lineout = self.prefilter(line,continue_prompt) 1776 lineout = self.prefilter(line,continue_prompt) 1770 debugp('lineout') 1771 return lineout 1777 return lineout 1772 1778 1773 def split_user_input(self,line): 1779 def split_user_input(self,line): @@ -1947,7 +1953,6 want to merge them back into the new files.""" % locals() 1947 if (continue_prompt and self.autoindent and line.isspace() and 1953 if (continue_prompt and self.autoindent and line.isspace() and 1948 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or 1954 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or 1949 (self.buffer[-1]).isspace() )): 1955 (self.buffer[-1]).isspace() )): 1950 #print 'reset line' # dbg 1951 line = '' 1956 line = '' 1952 1957 1953 self.log(line,continue_prompt) 1958 self.log(line,continue_prompt)
 @@ -51,8 +51,8 python2.3 ./setup.py bdist_rpm --release=py23 --python=/usr/bin/python2.3 51 python2.4 ./setup.py bdist_rpm --release=py24 --python=/usr/bin/python2.4 51 python2.4 ./setup.py bdist_rpm --release=py24 --python=/usr/bin/python2.4 52 52 53 # Build eggs 53 # Build eggs 54 python2.3 ./setup_bdist_egg.py 54 python2.3 ./eggsetup.py bdist_egg 55 python2.4 ./setup_bdist_egg.py 55 python2.4 ./eggsetup.py bdist_egg 56 56 57 # Call the windows build separately, so that the extra Windows scripts don't 57 # Call the windows build separately, so that the extra Windows scripts don't 58 # get pulled into Unix builds (setup.py has code which checks for 58 # get pulled into Unix builds (setup.py has code which checks for @@ -64,7 +64,6 python2.4 ./setup_bdist_egg.py 64 $HOME/tmp/local/bin/python2.3 setup.py bdist_wininst \ 64$HOME/tmp/local/bin/python2.3 setup.py bdist_wininst \ 65 --install-script=ipython_win_post_install.py 65 --install-script=ipython_win_post_install.py 66 66 67 68 # Register with the Python Package Index (PyPI) 67 # Register with the Python Package Index (PyPI) 69 echo "Registering with PyPI..." 68 echo "Registering with PyPI..." 70 cd $ipdir 69 cd$ipdir