mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Warn users to add pyenv init --path
to ~/.profile
To facilitate migration
This commit is contained in:
parent
7838707595
commit
3e3f40fefc
2 changed files with 15 additions and 0 deletions
|
@ -61,6 +61,7 @@ function main() {
|
||||||
;;
|
;;
|
||||||
"print")
|
"print")
|
||||||
init_dirs
|
init_dirs
|
||||||
|
warn_path
|
||||||
print_env
|
print_env
|
||||||
print_completion
|
print_completion
|
||||||
print_shell_function
|
print_shell_function
|
||||||
|
@ -132,6 +133,13 @@ function print_path() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function warn_path() {
|
||||||
|
if ! perl -ls0x3A -e 'while (<>) { chomp; ($_ eq $d) && exit 0; } exit 1' -- -d="${PYENV_ROOT}/shims" <<<"$PATH" ; then
|
||||||
|
echo 'echo '\''WARNING: `pyenv init -` no longer sets PATH.'\'
|
||||||
|
echo 'echo '\''Run `pyenv init` to see the necessary changes to make to your configuration.'\'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function print_env() {
|
function print_env() {
|
||||||
case "$shell" in
|
case "$shell" in
|
||||||
fish )
|
fish )
|
||||||
|
|
|
@ -90,6 +90,13 @@ OUT
|
||||||
assert_line 0 "set -gx PATH '${PYENV_ROOT}/shims' \$PATH"
|
assert_line 0 "set -gx PATH '${PYENV_ROOT}/shims' \$PATH"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "prints a warning if shims not in PATH" {
|
||||||
|
export PATH="$(perl -0x3A -ls -e 'while (<>) { chomp; ($_ ne $d) && print; }' -- -d="${PYENV_ROOT}/shims" <<<"$PATH")"
|
||||||
|
run pyenv-init -
|
||||||
|
assert_success
|
||||||
|
assert_line 0 'echo '\''WARNING: `pyenv init -` no longer sets PATH.'\'
|
||||||
|
}
|
||||||
|
|
||||||
@test "outputs sh-compatible syntax" {
|
@test "outputs sh-compatible syntax" {
|
||||||
run pyenv-init - bash
|
run pyenv-init - bash
|
||||||
assert_success
|
assert_success
|
||||||
|
|
Loading…
Reference in a new issue