poetry2nix/fetch-wheel.sh

10 lines
427 B
Bash
Raw Normal View History

2020-04-30 00:09:13 +02:00
source $stdenv/setup
echo "trying prediction first $predictedURL"
curl -L -k $predictedURL --output $out
if ! [ $? -ne 0 ]; then
echo "prediction failed, asking PyPI's API"
URL_FROM_API=$(curl -L -k "https://pypi.org/pypi/$pname/json" | jq -r ".releases.\"$version\"[] | select(.filename == \"$file\") | .url")
echo "trying $URL_FROM_API"
curl -k $URL_FROM_API --output $out
fi