mirror of
https://github.com/vale981/poetry2nix
synced 2025-03-04 16:51:40 -05:00

Previously we randomly encountered issues where the Pypi mirror URLs wouldn't be correct with packages whos first character is frequently written in upper case (e.g. SqlAlchemy, MarkupSafe, ...). The Pypi mirrors are aparently not consistent in the naming of the file locations which lead to random errors after package version bumps. By falling back to the API lookup (that we already did for wheels) we can workaround that situation.
24 lines
655 B
Bash
24 lines
655 B
Bash
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 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
|