From a83a528333bceb1ef320dbb8ddcde10494e7c7d0 2006-11-02 19:13:12 From: vivainio Date: 2006-11-02 19:13:12 Subject: [PATCH] import completer: only crippled 'local' version for py 2.4 --- diff --git a/IPython/Extensions/ipy_stock_completers.py b/IPython/Extensions/ipy_stock_completers.py index 1acfc46..a65ceb2 100755 --- a/IPython/Extensions/ipy_stock_completers.py +++ b/IPython/Extensions/ipy_stock_completers.py @@ -12,7 +12,7 @@ update upgrade """ import IPython.ipapi -import glob,os,shlex +import glob,os,shlex,sys ip = IPython.ipapi.get() @@ -49,10 +49,16 @@ pkg_cache = None def module_completer(self,event): """ Give completions after user has typed 'import' """ - + + # only a local version for py 2.4, pkgutil has no walk_packages() there + if sys.version_info < (2,5): + for el in [f[:-3] for f in glob.glob("*.py")]: + yield el + return + global pkg_cache import pkgutil,imp,time - #current = + #current = if pkg_cache is None: print "\n\n[Standby while scanning modules, this can take a while]\n\n" pkg_cache = list(pkgutil.walk_packages()) @@ -121,4 +127,4 @@ def cd_completer(self, event): return [relpath] return found -ip.set_hook('complete_command', cd_completer, str_key = '%cd') \ No newline at end of file +ip.set_hook('complete_command', cd_completer, str_key = '%cd')