diff options
author | Antony Lee <antony.lee@berkeley.edu> | 2015-07-26 09:53:57 +0900 |
---|---|---|
committer | Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> | 2015-07-26 09:55:13 +0900 |
commit | 77af941a05a3d3441c78e533aaf624ce9c15c418 (patch) | |
tree | 607355e2d4f63273d59320e90aa4e82745dfb70d /Completion/Unix | |
parent | 1629d5bcbd8263fcaad408db8c609969269360ef (diff) | |
download | zsh-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_modules | 6 |
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 \ |