Remove deprecated version parser; refactor to add quotes and remove useless code
This commit is contained in:
parent
0c6d262b1a
commit
7daf896739
4 changed files with 20 additions and 26 deletions
|
@ -1,13 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
get_legacy_version() {
|
||||
local current_directory="$1"
|
||||
local python_version_file="$current_directory/.python-version"
|
||||
|
||||
# Get version from .python-version file. .python-version is used by pyenv
|
||||
if [ -f "$python_version_file" ]; then
|
||||
cat "$python_version_file"
|
||||
fi
|
||||
}
|
||||
|
||||
get_legacy_version "$1"
|
25
bin/install
25
bin/install
|
@ -1,20 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source $(dirname $0)/utils.sh
|
||||
set -e
|
||||
|
||||
source "$(dirname "$0")"/utils.sh
|
||||
|
||||
install_python() {
|
||||
local version="$1"
|
||||
local install_path="$2"
|
||||
local install_type=$1
|
||||
local version=$2
|
||||
local install_path=$3
|
||||
|
||||
local tmp_dir="$(mktemp -d -t asdf-python.XXX)"
|
||||
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
|
||||
|
||||
ensure_python_build_installed
|
||||
|
||||
ASDF_CONCURRENCY="${ASDF_CONCURRENCY:-1}"
|
||||
echo "python-build $version $install_path"
|
||||
MAKE_OPTS="$MAKE_OPTS -j$ASDF_CONCURRENCY" TMP_DIR="$tmp_dir" $(python_build_path) $version $install_path
|
||||
echo "Cleaning up"
|
||||
rm -rf "$tmp_dir"
|
||||
$(python_build_path) "$version" "$install_path"
|
||||
}
|
||||
|
||||
install_python $ASDF_INSTALL_VERSION $ASDF_INSTALL_PATH
|
||||
ensure_python_build_installed
|
||||
install_python "$ASDF_INSTALL_TYPE" "$ASDF_INSTALL_VERSION" "$ASDF_INSTALL_PATH"
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source $(dirname $0)/utils.sh
|
||||
source "$(dirname "$0")/utils.sh"
|
||||
|
||||
list_all() {
|
||||
ensure_python_build_installed
|
||||
|
||||
$(python_build_path) --definitions | tr '\n' ' '
|
||||
rm -rf "$tmp_download_dir"
|
||||
}
|
||||
|
||||
list_all
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
echoerr() {
|
||||
printf "\033[0;31m%s\033[0m" "$1" >&2
|
||||
}
|
||||
|
||||
ensure_python_build_installed() {
|
||||
if [ ! -f "$(python_build_path)" ]; then
|
||||
download_python_build
|
||||
|
|
Loading…
Reference in a new issue