From 2e1c75679398a89197fef873dafbcfc41c5f74df Mon Sep 17 00:00:00 2001 From: Christian Fredrik Johnsen Date: Sat, 21 Dec 2024 13:50:00 +0100 Subject: [PATCH] revert: do not use PYENV_ROOT when printing path to completions. Homebrew installations have PYENV_ROOT set to `~/.pyenv`, while the actual completion file resides in /home/linuxbrew/.linuxbrew/Cellar/pyenv/2.4.23/completions/pyenv.zsh Thus, if you try to use `$PYENV_ROOT/completions/pyenv.${shell}`, the completions file will not be found, since you are pointing to: `~/.pyenv/completions/pyenv.zsh` when the actual location is: `/home/linuxbrew/.linuxbrew/Cellar/pyenv/2.4.23/completions/pyenv.zsh` This problem is resolved by using the parent folder of the currently executing file: `/home/linuxbrew/.linuxbrew/Cellar/pyenv/2.4.23/libexec/pyenv-init` which is `/home/linuxbrew/.linuxbrew/Cellar/pyenv/2.4.23` And then go to completions from there. I don't like the fact that homebrew installations store some things in `/home/linuxbrew/.linuxbrew/Cellar/pyenv/2.4.23/libexec/pyenv-init` while stuff like `shims` and python versions are stored in `~/.pyenv`, but that's how it currently is. --- libexec/pyenv-init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/pyenv-init b/libexec/pyenv-init index c68e00fb..b2dfab22 100755 --- a/libexec/pyenv-init +++ b/libexec/pyenv-init @@ -237,7 +237,7 @@ function print_env() { } function print_completion() { - completion="${PYENV_ROOT}/completions/pyenv.${shell}" + completion="${0%/*/*}/completions/pyenv.${shell}" if [ -r "$completion" ]; then echo "source '$completion'" fi