mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-14 20:39:55 -05:00
Allow system Python in sbin
Arch Linux has Python is sbin as well as bin
This commit is contained in:
parent
90d0d20508
commit
26134d9b38
2 changed files with 12 additions and 1 deletions
|
@ -33,7 +33,9 @@ OLDIFS="$IFS"
|
||||||
if PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python 2>/dev/null)" || \
|
if PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python 2>/dev/null)" || \
|
||||||
PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python3 2>/dev/null)" || \
|
PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python3 2>/dev/null)" || \
|
||||||
PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python2 2>/dev/null)"; then
|
PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python2 2>/dev/null)"; then
|
||||||
PYENV_PREFIX_PATH="${PYTHON_PATH%/bin/*}"
|
shopt -s extglob
|
||||||
|
# In some distros (Arch), Python can be found in sbin as well as bin
|
||||||
|
PYENV_PREFIX_PATH="${PYTHON_PATH%/?(s)bin/*}"
|
||||||
PYENV_PREFIX_PATH="${PYENV_PREFIX_PATH:-/}"
|
PYENV_PREFIX_PATH="${PYENV_PREFIX_PATH:-/}"
|
||||||
else
|
else
|
||||||
echo "pyenv: system version not found in PATH" >&2
|
echo "pyenv: system version not found in PATH" >&2
|
||||||
|
|
|
@ -24,6 +24,15 @@ load test_helper
|
||||||
assert_success "$PYENV_TEST_DIR"
|
assert_success "$PYENV_TEST_DIR"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#Arch has Python at sbin as well as bin
|
||||||
|
@test "prefix for sbin system" {
|
||||||
|
mkdir -p "${PYENV_TEST_DIR}/sbin"
|
||||||
|
touch "${PYENV_TEST_DIR}/sbin/python"
|
||||||
|
chmod +x "${PYENV_TEST_DIR}/sbin/python"
|
||||||
|
PYENV_VERSION="system" run pyenv-prefix
|
||||||
|
assert_success "$PYENV_TEST_DIR"
|
||||||
|
}
|
||||||
|
|
||||||
@test "prefix for system in /" {
|
@test "prefix for system in /" {
|
||||||
mkdir -p "${BATS_TEST_DIRNAME}/libexec"
|
mkdir -p "${BATS_TEST_DIRNAME}/libexec"
|
||||||
cat >"${BATS_TEST_DIRNAME}/libexec/pyenv-which" <<OUT
|
cat >"${BATS_TEST_DIRNAME}/libexec/pyenv-which" <<OUT
|
||||||
|
|
Loading…
Reference in a new issue