asdf-python/bin/install
2016-08-30 15:25:56 +09:00

27 lines
779 B
Bash
Executable file

#!/usr/bin/env bash
install_python() {
local version="$1"
local install_path="$2"
local tmp_download_dir="$(mktemp -d -t asdf-python.XXX)"
echo "Downloading python-build..."
download_python_build $tmp_download_dir > /dev/null 2>&1
local python_build="$tmp_download_dir/pyenv/plugins/python-build/bin/python-build"
ASDF_CONCURRENCY="${ASDF_CONCURRENCY:-1}"
echo "python-build $version $install_path"
MAKE_OPTS="$MAKE_OPTS -j$ASDF_CONCURRENCY" TMP_DIR="$tmp_download_dir" $python_build $version $install_path
echo "Cleaning up"
rm -rf "$tmp_download_dir"
}
download_python_build() {
local tmp_dir="$1"
local pyenv_url="git://github.com/yyuu/pyenv.git"
git clone $pyenv_url $tmp_dir/pyenv
}
install_python $ASDF_INSTALL_VERSION $ASDF_INSTALL_PATH