updated alternatives_set_python.sh

pull/2/head
Hari Sekhon 2 years ago
parent 0ed55c4fea
commit 4161b37c3f

@ -24,6 +24,15 @@ sudo=""
#$sudo ln -sv `type -P python2` /usr/local/bin/python
alternatives(){
# not available on Alpine
if type -P alternatives &>/dev/null; then
$sudo alternatives --set python "$@"
else
$sudo ln -sv "$1" /usr/local/bin/python
fi
}
if ! type -P python &>/dev/null; then
set +e
python2="$(type -P python2 2>/dev/null)"
@ -31,10 +40,14 @@ if ! type -P python &>/dev/null; then
set -e
if [ -n "$python3" ]; then
echo "alternatives: setting python -> $python3"
$sudo alternatives --set python "$python3"
# using function wrapper instead for Alpine
#$sudo alternatives --set python "$python3"
alternatives "$python3"
elif [ -n "$python2" ]; then
echo "alternatives: setting python -> $python2"
$sudo alternatives --set python "$python2"
# using function wrapper instead for Alpine
#$sudo alternatives --set python "$python2"
alternatives "$python2"
fi
fi

Loading…
Cancel
Save