Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 

35 rader
875 B

#!/usr/bin/env bash
# Summary: Detect the file that sets the current pyenv version
set -e
[ -n "$PYENV_DEBUG" ] && set -x
find_local_version_file() {
local root="$1"
while true; do
[[ "$root" =~ ^//[^/]*$ ]] && break
if [ -e "${root}/.python-version" ]; then
echo "${root}/.python-version"
exit
elif [ -e "${root}/.pyenv-version" ]; then
echo "${root}/.pyenv-version"
exit
fi
[ -n "$root" ] || break
root="${root%/*}"
done
}
find_local_version_file "$PYENV_DIR"
[ "$PYENV_DIR" = "$PWD" ] || find_local_version_file "$PWD"
global_version_file="${PYENV_ROOT}/version"
if [ -e "$global_version_file" ]; then
echo "$global_version_file"
elif [ -e "${PYENV_ROOT}/global" ]; then
echo "${PYENV_ROOT}/global"
elif [ -e "${PYENV_ROOT}/default" ]; then
echo "${PYENV_ROOT}/default"
else
echo "$global_version_file"
fi