poetry2nix/fetch-wheel.sh
2020-05-03 10:10:09 +01:00

9 lines
427 B
Bash

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