2016-04-24 10:28:48 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2018-04-13 23:26:06 +01:00
|
|
|
set -e
|
2017-01-22 09:31:29 +00:00
|
|
|
|
2018-04-06 09:14:25 +01:00
|
|
|
source "$(dirname "$0")/utils.sh"
|
2016-04-24 10:28:48 +01:00
|
|
|
|
2018-04-13 23:26:06 +01:00
|
|
|
install_python() {
|
|
|
|
local install_type=$1
|
|
|
|
local version=$2
|
|
|
|
local install_path=$3
|
2016-04-24 10:28:48 +01:00
|
|
|
|
2018-04-13 23:26:06 +01:00
|
|
|
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
|
2018-04-06 09:14:25 +01:00
|
|
|
install_or_update_python_build
|
2016-04-24 10:28:48 +01:00
|
|
|
|
2016-08-30 07:25:56 +01:00
|
|
|
echo "python-build $version $install_path"
|
2018-04-13 23:26:06 +01:00
|
|
|
$(python_build_path) "$version" "$install_path"
|
2016-04-24 10:28:48 +01:00
|
|
|
}
|
|
|
|
|
2018-09-24 22:30:16 +01:00
|
|
|
install_default_python_packages() {
|
|
|
|
local default_python_packages="${HOME}/.default-python-packages"
|
|
|
|
if [ ! -f $default_python_packages ]; then return; fi
|
|
|
|
for name in $(cat $default_python_packages); do
|
|
|
|
echo -ne "\nInstalling \e[33m${name}\e[39m python package ... "
|
2018-08-13 15:55:51 +01:00
|
|
|
if pip install $name > /dev/null 2>&1; then
|
|
|
|
echo -e "\e[32mSUCCESS\e[39m"
|
|
|
|
else
|
|
|
|
echo -e "\e[31mFAIL\e[39m"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2018-04-13 23:26:06 +01:00
|
|
|
ensure_python_build_installed
|
|
|
|
install_python "$ASDF_INSTALL_TYPE" "$ASDF_INSTALL_VERSION" "$ASDF_INSTALL_PATH"
|
2018-09-24 22:30:16 +01:00
|
|
|
install_default_python_packages
|