chore(sync): merge upstream startup optimizations
This commit is contained in:
commit
6799b3fd20
3 files changed
+26
-7
No files matched your search
@@ -216,6 +216,26 @@ HOME="$pyenv_env_home" XDG_CONFIG_HOME="$pyenv_env_xdg" \
|
||||
zsh -lc '[[ "$(command -v python3)" == "$HOME/.pyenv/shims/python3" ]]' ||
|
||||
fail "pyenv Python is not restored in login zsh after the system profile"
|
||||
|
||||
# Interactive initialization runs once while repeated sourcing restores PATH.
|
||||
mkdir -p "$pyenv_env_home/.pyenv/bin"
|
||||
cat >"$pyenv_env_home/.pyenv/bin/pyenv" <<'PYENV'
|
||||
#!/bin/sh
|
||||
printf '%s\n' "$*" >> "$PYENV_ROOT/init-calls"
|
||||
printf '%s\n' 'pyenv() { command pyenv "$@"; }'
|
||||
PYENV
|
||||
chmod +x "$pyenv_env_home/.pyenv/bin/pyenv"
|
||||
HOME="$pyenv_env_home" PYENV_ROOT="$pyenv_env_home/.pyenv" PATH=/usr/bin:/bin \
|
||||
zsh -dfic '
|
||||
source "$1"
|
||||
(( $+functions[pyenv] )) || exit 1
|
||||
path=(/usr/bin /bin)
|
||||
source "$1"
|
||||
[[ $(command -v python3) == "$PYENV_ROOT/shims/python3" ]]
|
||||
' zsh "$ROOT/zsh/pyenv.zsh" ||
|
||||
fail "interactive pyenv initialization did not preserve its function and Python PATH"
|
||||
printf '%s\n' 'init - --no-rehash zsh' | cmp -s - "$pyenv_env_home/.pyenv/init-calls" ||
|
||||
fail "pyenv initialization must run once without a startup rehash"
|
||||
|
||||
# A later easyzsh migration still restores pyenv; the old pyenv-only hook is replaced.
|
||||
pyenv_login_hook='[[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/pyenv.zsh" ]] && . "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/pyenv.zsh"'
|
||||
printf '%s\n' "$pyenv_login_hook" > "$pyenv_env_home/.zprofile"
|
||||
|
||||
Reference in new issue
Block a user