summary refs log tree commit diff
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
parent1629d5bcbd8263fcaad408db8c609969269360ef (diff)
downloadzsh-77af941a05a3d3441c78e533aaf624ce9c15c418.tar.gz
zsh-77af941a05a3d3441c78e533aaf624ce9c15c418.tar.xz
zsh-77af941a05a3d3441c78e533aaf624ce9c15c418.zip
faster method of generating list of python modules
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Type/_python_modules6
2 files changed, 7 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 86cd9a3bd..15acc1b6a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-07-26  Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+	* Antony Lee: 35899: Completion/Unix/Type/_python_modules:
+	faster method of generating list of python modules
+
 2015-07-25  Barton E. Schaefer  <schaefer@zsh.org>
 
 	* unposted: Functions/Prompts/prompt_bart_setup: add RPS2 handling,
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 \