From 3d816bb4ca3f088195bd01c1d42fba2c6f11d213 2006-05-30 03:36:04 From: fperez Date: 2006-05-30 03:36:04 Subject: [PATCH] Close #64, if W. Maier confirms this fix works. --- diff --git a/IPython/iplib.py b/IPython/iplib.py index c7236e8..41d114c 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 1332 2006-05-30 01:41:28Z fperez $ +$Id: iplib.py 1334 2006-05-30 03:36:04Z fperez $ """ #***************************************************************************** @@ -549,18 +549,33 @@ class InteractiveShell(object,Magic): # a better ls 'ls ls -F', # long ls - 'll ls -lF', - # color ls - 'lc ls -F -o --color', - # ls normal files only - 'lf ls -F -o --color %l | grep ^-', - # ls symbolic links - 'lk ls -F -o --color %l | grep ^l', - # directories or links to directories, - 'ldir ls -F -o --color %l | grep /$', - # things which are executable - 'lx ls -F -o --color %l | grep ^-..x', - ) + 'll ls -lF') + # Extra ls aliases with color, which need special treatment on BSD + # variants + ls_extra = ( # color ls + 'lc ls -F -o --color', + # ls normal files only + 'lf ls -F -o --color %l | grep ^-', + # ls symbolic links + 'lk ls -F -o --color %l | grep ^l', + # directories or links to directories, + 'ldir ls -F -o --color %l | grep /$', + # things which are executable + 'lx ls -F -o --color %l | grep ^-..x', + ) + # The BSDs don't ship GNU ls, so they don't understand the + # --color switch out of the box + if 'bsd' in sys.platform: + ls_extra = ( # ls normal files only + 'lf ls -F -o %l | grep ^-', + # ls symbolic links + 'lk ls -F -o %l | grep ^l', + # directories or links to directories, + 'ldir ls -F -o %l | grep /$', + # things which are executable + 'lx ls -F -o %l | grep ^-..x', + ) + auto_alias = auto_alias + ls_extra elif os.name in ['nt','dos']: auto_alias = ('dir dir /on', 'ls dir /on', 'ddir dir /ad /on', 'ldir dir /ad /on', @@ -568,7 +583,7 @@ class InteractiveShell(object,Magic): 'ren ren','cls cls','copy copy') else: auto_alias = () - self.auto_alias = map(lambda s:s.split(None,1),auto_alias) + self.auto_alias = [s.split(None,1) for s in auto_alias] # Call the actual (public) initializer self.init_auto_alias() diff --git a/doc/ChangeLog b/doc/ChangeLog index 3329fee..e3e4f07 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,10 @@ 2006-05-29 Fernando Perez + * IPython/iplib.py (InteractiveShell.__init__): add check for the + *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't + recognize the option. After a bug report by Will Maier. This + closes #64 (will do it after confirmation from W. Maier). + * IPython/irunner.py: New module to run scripts as if manually typed into an interactive environment, based on pexpect. After a submission by Ken Schutte on the