From 23e53bee5b2b03d215f63e009398d54e67df5b89 2007-05-15 15:31:25 From: vivainio Date: 2007-05-15 15:31:25 Subject: [PATCH] Aliases are now lowercase on win32 --- diff --git a/IPython/Extensions/ext_rehashdir.py b/IPython/Extensions/ext_rehashdir.py index c429995..ef887ee 100644 --- a/IPython/Extensions/ext_rehashdir.py +++ b/IPython/Extensions/ext_rehashdir.py @@ -92,6 +92,7 @@ def rehashdir_f(self,arg): for ff in os.listdir(pdir): if isexec(ff) and not isjunk(ff): src, tgt = execre.sub(r'\1',ff), os.path.abspath(ff) + src = src.lower() print "Aliasing:",src,"->",tgt alias_table[src] = (0,tgt) # Make sure the alias table doesn't contain keywords or builtins diff --git a/IPython/Magic.py b/IPython/Magic.py index 638fcd1..2cd014e 100644 --- a/IPython/Magic.py +++ b/IPython/Magic.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Magic functions for InteractiveShell. -$Id: Magic.py 2344 2007-05-15 15:09:39Z vivainio $""" +$Id: Magic.py 2345 2007-05-15 15:31:25Z vivainio $""" #***************************************************************************** # Copyright (C) 2001 Janko Hauser and @@ -2592,7 +2592,7 @@ Defaulting color scheme to 'NoColor'""" if isexec(ff) and base not in self.shell.no_alias: if ext.lower() == '.exe': ff = base - alias_table[base] = (0,ff) + alias_table[base.lower()] = (0,ff) syscmdlist.append(ff) # Make sure the alias table doesn't contain keywords or builtins self.shell.alias_table_validate() diff --git a/IPython/UserConfig/ipy_profile_sh.py b/IPython/UserConfig/ipy_profile_sh.py index de47ac6..3114858 100644 --- a/IPython/UserConfig/ipy_profile_sh.py +++ b/IPython/UserConfig/ipy_profile_sh.py @@ -80,10 +80,17 @@ def main(): """) ip.magic('rehashx') syscmds = db.get("syscmdlist") + + # locase aliases on win#2 only + if os.name == 'posix': + mapper = lambda s:s + else: + def mapper(s): return s.lower() + for cmd in syscmds: #print "al",cmd noext, ext = os.path.splitext(cmd) - ip.IP.alias_table[noext] = (0,cmd) + ip.IP.alias_table[mapper(noext)] = (0,cmd) extend_shell_behavior(ip) def extend_shell_behavior(ip):