1{ stdenv, buildPythonPackage, isPy3k, fetchFromGitHub, fetchurl 2, eject, pygit2, gitMinimal, git-annex }: 3 4buildPythonPackage rec { 5 pname = "git-annex-adapter"; 6 version = "0.2.0"; 7 name = "${pname}-${version}"; 8 9 disabled = (!isPy3k); 10 11 # There is only a wheel on PyPI - build from source instead 12 src = fetchFromGitHub { 13 owner = "alpernebbi"; 14 repo = pname; 15 rev = "v${version}"; 16 sha256 = "1sbgp4ivgw4m8nngrlb1f78xdnssh639c1khv4z98753w3sdsxdz"; 17 }; 18 19 prePatch = '' 20 substituteInPlace git_annex_adapter/process.py \ 21 --replace "'git', 'annex'" "'${git-annex}/bin/git-annex'" \ 22 --replace "'git-annex'" "'${git-annex}/bin/git-annex'" 23 ''; 24 25 # TODO: Remove for next version 26 patches = fetchurl { 27 url = "https://github.com/alpernebbi/git-annex-adapter/commit/9f64c4b99cae7b681820c6c7382e1e40489f4d1e.patch"; 28 sha256 = "1hbw8651amjskakvs1wv2msd1wryrq0vpryvbispg5267rs8q7hp"; 29 }; 30 31 nativeBuildInputs = [ 32 eject # `rev` is needed in tests/test_process.py 33 ]; 34 35 propagatedBuildInputs = [ pygit2 gitMinimal ]; 36 37 buildInputs = [ git-annex ]; 38 39 checkPhase = '' 40 python -m unittest 41 ''; 42 43 meta = with stdenv.lib; { 44 homepage = https://github.com/alpernebbi/git-annex-adapter; 45 description = "Call git-annex commands from Python"; 46 license = licenses.gpl3Plus; 47 maintainers = with maintainers; [ dotlambda ]; 48 }; 49}