mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Merge pull request #661 from yyuu/workaroud-bin-python
Add workaround for `/bin/python`
This commit is contained in:
commit
740fbe4bda
2 changed files with 13 additions and 0 deletions
|
@ -32,6 +32,7 @@ OLDIFS="$IFS"
|
|||
if [ "$version" = "system" ]; then
|
||||
if PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python 2>/dev/null)"; then
|
||||
PYENV_PREFIX_PATH="${PYTHON_PATH%/bin/*}"
|
||||
PYENV_PREFIX_PATH="${PYENV_PREFIX_PATH:-/}"
|
||||
else
|
||||
echo "pyenv: system version not found in PATH" >&2
|
||||
exit 1
|
||||
|
|
|
@ -24,6 +24,18 @@ load test_helper
|
|||
assert_success "$PYENV_TEST_DIR"
|
||||
}
|
||||
|
||||
@test "prefix for system in /" {
|
||||
mkdir -p "${BATS_TEST_DIRNAME}/libexec"
|
||||
cat >"${BATS_TEST_DIRNAME}/libexec/pyenv-which" <<OUT
|
||||
#!/bin/sh
|
||||
echo /bin/python
|
||||
OUT
|
||||
chmod +x "${BATS_TEST_DIRNAME}/libexec/pyenv-which"
|
||||
PYENV_VERSION="system" run pyenv-prefix
|
||||
assert_success "/"
|
||||
rm -f "${BATS_TEST_DIRNAME}/libexec/pyenv-which"
|
||||
}
|
||||
|
||||
@test "prefix for invalid system" {
|
||||
PATH="$(path_without python)" run pyenv-prefix system
|
||||
assert_failure "pyenv: system version not found in PATH"
|
||||
|
|
Loading…
Reference in a new issue