diff options
Diffstat (limited to 'plugins/pip/pip.plugin.zsh')
-rw-r--r-- | plugins/pip/pip.plugin.zsh | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/pip/pip.plugin.zsh b/plugins/pip/pip.plugin.zsh index d7236b02a..a46e7658c 100644 --- a/plugins/pip/pip.plugin.zsh +++ b/plugins/pip/pip.plugin.zsh @@ -9,8 +9,12 @@ # If you would like to clear your cache, go ahead and do a # "zsh-pip-clear-cache". -ZSH_PIP_CACHE_FILE=~/.pip/zsh-cache -ZSH_PIP_INDEXES=(https://pypi.python.org/simple/) +if [[ -d "${XDG_CACHE_HOME:-$HOME/.cache}/pip" ]]; then + ZSH_PIP_CACHE_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/pip/zsh-cache" +else + ZSH_PIP_CACHE_FILE=~/.pip/zsh-cache +fi +ZSH_PIP_INDEXES=(https://pypi.org/simple/) zsh-pip-clear-cache() { rm $ZSH_PIP_CACHE_FILE @@ -29,9 +33,10 @@ zsh-pip-cache-packages() { if [[ ! -f $ZSH_PIP_CACHE_FILE ]]; then echo -n "(...caching package index...)" tmp_cache=/tmp/zsh_tmp_cache + touch $tmp_cache for index in $ZSH_PIP_INDEXES ; do # well... I've already got two problems - curl $index 2>/dev/null | \ + curl -L $index 2>/dev/null | \ zsh-pip-clean-packages \ >> $tmp_cache done |