summary refs log tree commit diff
path: root/pkgs/development/tools/poetry2nix/poetry2nix/fetch-wheel.sh
blob: 97f54b23416de22744c739caee638c67720a15ac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
source $stdenv/setup
set -euo pipefail

curl="curl            \
 --location           \
 --max-redirs 20      \
 --retry 2            \
 --disable-epsv       \
 --cookie-jar cookies \
 --insecure           \
 --speed-time 5       \
 -#                   \
 --fail               \
 $curlOpts            \
 $NIX_CURL_FLAGS"

echo "Trying to fetch wheel with predicted URL: $predictedURL"

$curl $predictedURL --output $out && exit 0

echo "Predicted URL '$predictedURL' failed, querying pypi.org"
$curl "https://pypi.org/pypi/$pname/json" | jq -r ".releases.\"$version\"[] | select(.filename == \"$file\") | .url" > url
url=$(cat url)
$curl -k $url --output $out