fix(pyenv): preserve shims in login shells
macOS path_helper runs after .zshenv and can move system Python ahead of pyenv. Add an idempotent login hook and preserve it across later easyzsh migrations.
This commit is contained in:
@@ -68,6 +68,11 @@ is_easyzsh_zprofile_stub() {
|
||||
grep -Eq 'easyzsh|PATH lives in|Leave this file empty|prefer.*local\.zsh' "$f"
|
||||
}
|
||||
|
||||
has_pyenv_login_hook() {
|
||||
local hook='[[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/pyenv.zsh" ]] && . "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/pyenv.zsh"'
|
||||
[[ -f "$1" ]] && grep -Fqx "$hook" "$1"
|
||||
}
|
||||
|
||||
echo "Deploying easyzsh shell stubs into $TARGET_HOME"
|
||||
|
||||
mkdir -p \
|
||||
@@ -101,7 +106,10 @@ fi
|
||||
|
||||
# Optional: fold a real (non-stub) ~/.zprofile into local.zsh.
|
||||
if [[ "$MIGRATE_ZPROFILE" -eq 1 && -f "$ZPROFILE" ]]; then
|
||||
if is_easyzsh_zprofile_stub "$ZPROFILE"; then
|
||||
if has_pyenv_login_hook "$ZPROFILE"; then
|
||||
# ponytail: keep the whole profile; split migration only if per-line ownership is needed.
|
||||
echo "Keeping ~/.zprofile: contains the pyenv login hook"
|
||||
elif is_easyzsh_zprofile_stub "$ZPROFILE"; then
|
||||
echo "Removing easyzsh ~/.zprofile stub (hooks live in local.zsh / .zshenv)"
|
||||
rm -f "$ZPROFILE"
|
||||
elif [[ ! -f "$LOCAL_ZSH" ]]; then
|
||||
|
||||
Reference in New Issue
Block a user