Merge pull request #143 from danhper/revert-139-master

Revert "added major/minor shorthands"
This commit is contained in:
Daniel Perez 2022-08-22 06:15:56 +01:00 committed by GitHub
commit 8d321f7b36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 51 deletions

View file

@ -6,12 +6,8 @@ source "$(dirname "$0")/utils.sh"
install_python() { install_python() {
local install_type=$1 local install_type=$1
local version local version=$2
local symlink_path=$3 local install_path=$3
local install_path
version="$(resolve_partial_version "$2")"
install_path="$(dirname "$symlink_path")/$version"
if [ "$install_type" != "version" ]; then if [ "$install_type" != "version" ]; then
echoerr "Cannot install specific ref from source, sorry." echoerr "Cannot install specific ref from source, sorry."
@ -32,13 +28,6 @@ install_python() {
echo "python-build $version $install_path" echo "python-build $version $install_path"
$(python_build_path) "$version" "$install_path" $(python_build_path) "$version" "$install_path"
fi fi
if [ "$install_path" != "$symlink_path" ]; then
# add a symlink for an alias like:
# ~/.asdf/installs/python/3 -> ~/.asdf/installs/python/3.1.2
rmdir "$symlink_path" # asdf creates this empty directory we don't want
ln -sfv "$install_path" "$symlink_path"
fi
} }
install_default_python_packages() { install_default_python_packages() {
@ -50,21 +39,6 @@ install_default_python_packages() {
fi fi
} }
fetch_all_versions() {
$(python_build_path) --definitions | grep -E '^\d+\.\d+\.\d+$' | sort -rV
}
resolve_partial_version() {
local version=$1
if [[ "$version" =~ ^[0-9]+(\.[0-9]+)?$ ]]; then
# maps a version like "3.0" or "3" to "3.1.2"
fetch_all_versions | grep -e "^$version\." | head -n1
else
echo "$version"
fi
}
ensure_python_build_installed ensure_python_build_installed
install_python "$ASDF_INSTALL_TYPE" "$ASDF_INSTALL_VERSION" "$ASDF_INSTALL_PATH" install_python "$ASDF_INSTALL_TYPE" "$ASDF_INSTALL_VERSION" "$ASDF_INSTALL_PATH"
install_default_python_packages install_default_python_packages

View file

@ -4,29 +4,7 @@ source "$(dirname "$0")/utils.sh"
list_all() { list_all() {
install_or_update_python_build install_or_update_python_build
echo $( $(python_build_path) --definitions | tr '\n' ' '
$(python_build_path) --definitions
echo 2
echo 2.1
echo 2.2
echo 2.3
echo 2.4
echo 2.5
echo 2.6
echo 2.7
echo 3
echo 3.0
echo 3.1
echo 3.2
echo 3.3
echo 3.4
echo 3.5
echo 3.6
echo 3.7
echo 3.8
echo 3.9
echo 3.10
) | tr '\n' ' '
} }
list_all list_all