Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
68 lines
1.5 KiB
Nix
68 lines
1.5 KiB
Nix
# `fetchPypi` function for fetching artifacts from PyPI.
|
|
{
|
|
fetchurl,
|
|
makeOverridable,
|
|
}:
|
|
|
|
let
|
|
computeUrl =
|
|
{
|
|
format ? "setuptools",
|
|
...
|
|
}@attrs:
|
|
let
|
|
computeWheelUrl =
|
|
{
|
|
pname,
|
|
version,
|
|
dist ? "py2.py3",
|
|
python ? "py2.py3",
|
|
abi ? "none",
|
|
platform ? "any",
|
|
}:
|
|
# Fetch a wheel. By default we fetch an universal wheel.
|
|
# See https://www.python.org/dev/peps/pep-0427/#file-name-convention for details regarding the optional arguments.
|
|
"https://files.pythonhosted.org/packages/${dist}/${builtins.substring 0 1 pname}/${pname}/${pname}-${version}-${python}-${abi}-${platform}.whl";
|
|
|
|
computeSourceUrl =
|
|
{
|
|
pname,
|
|
version,
|
|
extension ? "tar.gz",
|
|
}:
|
|
# Fetch a source tarball.
|
|
"mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${pname}-${version}.${extension}";
|
|
|
|
compute = (
|
|
if format == "wheel" then
|
|
computeWheelUrl
|
|
else if format == "setuptools" then
|
|
computeSourceUrl
|
|
else
|
|
throw "Unsupported format ${format}"
|
|
);
|
|
|
|
in
|
|
compute (removeAttrs attrs [ "format" ]);
|
|
|
|
in
|
|
makeOverridable (
|
|
{
|
|
format ? "setuptools",
|
|
sha256 ? "",
|
|
hash ? "",
|
|
...
|
|
}@attrs:
|
|
let
|
|
url = computeUrl (
|
|
removeAttrs attrs [
|
|
"sha256"
|
|
"hash"
|
|
]
|
|
);
|
|
in
|
|
fetchurl {
|
|
inherit url sha256 hash;
|
|
}
|
|
)
|