summary refs log tree commit diff
path: root/Completion/Unix
diff options
context:
space:
mode:
authorAntony Lee <antony.lee@berkeley.edu>2015-07-26 09:53:57 +0900
committerJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2015-07-26 09:55:13 +0900
commit77af941a05a3d3441c78e533aaf624ce9c15c418 (patch)
tree607355e2d4f63273d59320e90aa4e82745dfb70d /Completion/Unix
parent1629d5bcbd8263fcaad408db8c609969269360ef (diff)
downloadzsh-77af941a05a3d3441c78e533aaf624ce9c15c418.tar.gz
zsh-77af941a05a3d3441c78e533aaf624ce9c15c418.tar.xz
zsh-77af941a05a3d3441c78e533aaf624ce9c15c418.zip
faster method of generating list of python modules
Diffstat (limited to 'Completion/Unix')
-rw-r--r--Completion/Unix/Type/_python_modules6
1 files changed, 2 insertions, 4 deletions
diff --git a/Completion/Unix/Type/_python_modules b/Completion/Unix/Type/_python_modules
index b30848d83..e82f8efbf 100644
--- a/Completion/Unix/Type/_python_modules
+++ b/Completion/Unix/Type/_python_modules
@@ -26,10 +26,8 @@ _python_modules () {
   if ( [[ ${(P)+array_name} -eq 0 ]] || _cache_invalid $cache_id ) &&
       ! _retrieve_cache $cache_id; then
 
-    local script='import sys, pydoc
-def f(p,m,d):
-    if m.find(".") < 0: sys.stdout.write(m+"\n")
-pydoc.ModuleScanner().run(f)'
+   local script='import pkgutil
+for importer, name, ispkg in pkgutil.iter_modules(): print(name)'
 
     typeset -agU $array_name
     set -A $array_name \