diff --git a/IPython/ipapi.py b/IPython/ipapi.py index b2e51ca..1b2e065 100644 --- a/IPython/ipapi.py +++ b/IPython/ipapi.py @@ -476,7 +476,6 @@ class DebugTools: self.debugmode = False self.hotnames = set() - def hotname(self, name_to_catch): self.hotnames.add(name_to_catch) diff --git a/IPython/iplib.py b/IPython/iplib.py index 896651a..82401fb 100644 --- a/IPython/iplib.py +++ b/IPython/iplib.py @@ -6,7 +6,7 @@ Requires Python 2.3 or newer. This file contains all the classes and helper functions specific to IPython. -$Id: iplib.py 2652 2007-08-22 17:25:24Z vivainio $ +$Id: iplib.py 2674 2007-08-26 12:34:05Z vivainio $ """ #***************************************************************************** @@ -698,6 +698,7 @@ class InteractiveShell(object,Magic): # Load user aliases for alias in rc.alias: self.magic_alias(alias) + self.hooks.late_startup_hook() batchrun = False @@ -708,7 +709,8 @@ class InteractiveShell(object,Magic): continue self.api.runlines(batchfile.text()) batchrun = True - if batchrun: + # without -i option, exit after running the batch file + if batchrun and not self.rc.interact: self.exit_now = True def add_builtins(self): @@ -1522,7 +1524,8 @@ want to merge them back into the new files.""" % locals() #sys.argv = ['-c'] self.push(self.prefilter(self.rc.c, False)) - self.exit_now = True + if not self.rc.interact: + self.exit_now = True def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0): """Embeds IPython into a running python program. @@ -1621,7 +1624,7 @@ want to merge them back into the new files.""" % locals() # Mark activity in the builtins __builtin__.__dict__['__IPYTHON__active'] += 1 - + if self.has_readline: self.readline_startup_hook(self.pre_readline) # exit_now is set by a call to %Exit or %Quit diff --git a/IPython/ipmaker.py b/IPython/ipmaker.py index afa1741..e0f3d88 100644 --- a/IPython/ipmaker.py +++ b/IPython/ipmaker.py @@ -6,7 +6,7 @@ Requires Python 2.1 or better. This file contains the main make_IPython() starter function. -$Id: ipmaker.py 2672 2007-08-26 09:15:26Z vivainio $""" +$Id: ipmaker.py 2674 2007-08-26 12:34:05Z vivainio $""" #***************************************************************************** # Copyright (C) 2001-2006 Fernando Perez. @@ -176,7 +176,7 @@ object? -> Details about 'object'. ?object also works, ?? prints more. # The "ignore" option is a kludge so that Emacs buffers don't crash, since # the 'C-c !' command in emacs automatically appends a -i option at the end. - cmdline_only = ('help ignore|i ipythondir=s Version upgrade ' + cmdline_only = ('help interact|i ipythondir=s Version upgrade ' 'gthread! qthread! q4thread! wthread! pylab! tk!') # Build the actual name list to be used by DPyGetOpt @@ -199,7 +199,7 @@ object? -> Details about 'object'. ?object also works, ?? prints more. deep_reload = 0, editor = '0', help = 0, - ignore = 0, + interact = 0, ipythondir = ipythondir_def, log = 0, logfile = '', diff --git a/doc/ChangeLog b/doc/ChangeLog index 26aaf93..2e35842 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,12 @@ 2007-08-26 Ville Vainio * ipmaker.py: Command line args have the highest priority again + + * iplib.py, ipmaker.py: -i command line argument now behaves as in + normal python, i.e. leaves the IPython session running after -c + command or running a batch file from command line. + * 2007-08-22 Ville Vainio * iplib.py: no extra empty (last) line in raw hist w/ multiline