Python fetchPypi: support an extension
Many source archives on PyPI are tar.gz archives. Not all are, and therefore this commit adds the possibility to set the extension of the archive.
This commit is contained in:
parent
812e8ed1b5
commit
65477dcd34
1 changed files with 3 additions and 7 deletions
|
@ -53,15 +53,11 @@ let
|
|||
let
|
||||
url = "https://files.pythonhosted.org/packages/${python}/${builtins.substring 0 1 pname}/${pname}/${pname}-${version}-${python}-${abi}-${platform}.whl";
|
||||
in pkgs.fetchurl {inherit url sha256;};
|
||||
|
||||
fetchSource = {pname, version, sha256}:
|
||||
fetchSource = {pname, version, sha256, extension ? "tar.gz"}:
|
||||
# Fetch a source tarball.
|
||||
let
|
||||
urls = [
|
||||
"mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${pname}-${version}.tar.gz"
|
||||
"mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${pname}-${version}.zip"
|
||||
];
|
||||
in pkgs.fetchurl {inherit urls sha256;};
|
||||
url = "mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${pname}-${version}.${extension}";
|
||||
in pkgs.fetchurl {inherit url sha256;};
|
||||
fetcher = (if format == "wheel" then fetchWheel
|
||||
else if format == "setuptools" then fetchSource
|
||||
else throw "Unsupported kind ${kind}");
|
||||
|
|
Loading…
Reference in a new issue