Skip to content

Commit

Permalink
devel/download-latest: Explicitly error if no packages can be found
Browse files Browse the repository at this point in the history
Avoids letting the issue surface as more distant and perplexing errors
in jq and wget.
  • Loading branch information
tsibley authored and victorlin committed Feb 5, 2025
1 parent 0f54622 commit ae05e8c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion devel/download-latest
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ export PATH="$env/bin:$PATH"
CONDA_SUBDIR="${CONDA_SUBDIR:-$("$repo"/devel/conda-subdir)}"
export CONDA_SUBDIR

wget "$(
url="$(
curl -fsSL https://api.anaconda.org/package/nextstrain/nextstrain-base/files | jq -r '
map(select(.labels|index("main")))
| map(select(.attrs.subdir == env.CONDA_SUBDIR))
| if length == 0 then ("error: download-latest: no packages found\n" | halt_error) else . end
| max_by([.version, .attrs.build_number])
| .download_url
| if startswith("//") then "https:\(.)" else . end
'
)"
wget "$url"

0 comments on commit ae05e8c

Please sign in to comment.