asdf-python/bin/install
2018-08-13 17:55:51 +03:00

38 lines
980 B
Bash
Executable file

#!/usr/bin/env bash
set -e
source "$(dirname "$0")/utils.sh"
install_python() {
local install_type=$1
local version=$2
local install_path=$3
if [ "$install_type" != "version" ]; then
echoerr "Cannot install specific ref from source, sorry."
echoerr "For a list of available versions, see \`asdf list-all python\`."
exit 1
fi
install_or_update_python_build
echo "python-build $version $install_path"
$(python_build_path) "$version" "$install_path"
}
install_default_eggs() {
local default_eggs="${HOME}/.default-eggs"
if [ ! -f $default_egg_packages ]; then return; fi
for name in $(cat $default_eggs); do
echo -ne "\nInstalling \e[33m${name}\e[39m egg ... "
if pip install $name > /dev/null 2>&1; then
echo -e "\e[32mSUCCESS\e[39m"
else
echo -e "\e[31mFAIL\e[39m"
fi
done
}
ensure_python_build_installed
install_python "$ASDF_INSTALL_TYPE" "$ASDF_INSTALL_VERSION" "$ASDF_INSTALL_PATH"
install_default_eggs