Skip to content

Commit 65477dc

Browse files
mt-caretFRidh
authored andcommittedMay 24, 2017
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.
1 parent 812e8ed commit 65477dc

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed
 

‎pkgs/top-level/python-packages.nix

+3-7
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,11 @@ let
5353
let
5454
url = "https://files.pythonhosted.org/packages/${python}/${builtins.substring 0 1 pname}/${pname}/${pname}-${version}-${python}-${abi}-${platform}.whl";
5555
in pkgs.fetchurl {inherit url sha256;};
56-
57-
fetchSource = {pname, version, sha256}:
56+
fetchSource = {pname, version, sha256, extension ? "tar.gz"}:
5857
# Fetch a source tarball.
5958
let
60-
urls = [
61-
"mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${pname}-${version}.tar.gz"
62-
"mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${pname}-${version}.zip"
63-
];
64-
in pkgs.fetchurl {inherit urls sha256;};
59+
url = "mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${pname}-${version}.${extension}";
60+
in pkgs.fetchurl {inherit url sha256;};
6561
fetcher = (if format == "wheel" then fetchWheel
6662
else if format == "setuptools" then fetchSource
6763
else throw "Unsupported kind ${kind}");

0 commit comments

Comments
 (0)