Skip to content

Commit 05bdeaa

Browse files
dwinkDavid Harks
and
David Harks
authored
feat: Handle ruff's packaging changes for 0.5.0+ (simhem#7)
Co-authored-by: David Harks <[email protected]>
1 parent 97b4f67 commit 05bdeaa

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

bin/download

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ release_file="$ASDF_DOWNLOAD_PATH/$TOOL_NAME-$ASDF_INSTALL_VERSION.${ext}"
1919
download_release "$ASDF_INSTALL_VERSION" "$release_file"
2020

2121
# Extract contents of tar.gz file into the download directory
22-
tar -xvzf "$release_file" -C "$ASDF_DOWNLOAD_PATH" || fail "Could not extract $release_file"
22+
if [[ "$ASDF_INSTALL_VERSION" < "0.5.0" ]]; then
23+
tar -xvzf "$release_file" -C "$ASDF_DOWNLOAD_PATH" || fail "Could not extract $release_file"
24+
else
25+
tar --strip-components=1 -xvzf "$release_file" -C "$ASDF_DOWNLOAD_PATH" || fail "Could not extract $release_file"
26+
fi
2327

2428
# Remove the tar.gz file since we don't need to keep it
2529
rm "$release_file"

lib/utils.bash

+9-6
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,17 @@ download_release() {
8484
architecture="$(arch)"
8585
os=$(get_os)
8686
ext=$(get_ext)
87-
if [ "$os" == "apple-darwin" ]; then
88-
if [ "$architecture" == "arm64" ]; then
89-
architecture="aarch64"
90-
fi
87+
if [ "$os" == "apple-darwin" ]; then
88+
if [ "$architecture" == "arm64" ]; then
89+
architecture="aarch64"
90+
fi
9191
fi
92-
9392

94-
url="$GH_REPO/releases//download/v${version}/$TOOL_NAME-${version}-${architecture}-${os}.${ext}"
93+
if [[ "$version" < "0.5.0" ]]; then
94+
url="$GH_REPO/releases//download/v${version}/$TOOL_NAME-${version}-${architecture}-${os}.${ext}"
95+
else
96+
url="$GH_REPO/releases//download/${version}/$TOOL_NAME-${architecture}-${os}.${ext}"
97+
fi
9598

9699
echo "* Downloading $TOOL_NAME release $version..."
97100
curl "${curl_opts[@]}" -o "$filename" -C - "$url" || fail "Could not download $url"

0 commit comments

Comments
 (0)