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.

authored by Masayuki Takeda and committed by Frederik Rietdijk 65477dcd 812e8ed1

+3 -7
+3 -7
pkgs/top-level/python-packages.nix
··· 53 53 let 54 54 url = "https://files.pythonhosted.org/packages/${python}/${builtins.substring 0 1 pname}/${pname}/${pname}-${version}-${python}-${abi}-${platform}.whl"; 55 55 in pkgs.fetchurl {inherit url sha256;}; 56 - 57 - fetchSource = {pname, version, sha256}: 56 + fetchSource = {pname, version, sha256, extension ? "tar.gz"}: 58 57 # Fetch a source tarball. 59 58 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;}; 65 61 fetcher = (if format == "wheel" then fetchWheel 66 62 else if format == "setuptools" then fetchSource 67 63 else throw "Unsupported kind ${kind}");