1{ lib, buildPythonPackage, isPy3k, fetchFromGitHub, fetchpatch, substituteAll
2, python, util-linux, pygit2, gitMinimal, git-annex, cacert
3}:
4
5buildPythonPackage rec {
6 pname = "git-annex-adapter";
7 version = "0.2.2";
8
9 disabled = !isPy3k;
10
11 # No tests in PyPI tarball
12 src = fetchFromGitHub {
13 owner = "alpernebbi";
14 repo = pname;
15 rev = "v${version}";
16 sha256 = "0666vqspgnvmfs6j3kifwyxr6zmxjs0wlwis7br4zcq0gk32zgdx";
17 };
18
19 patches = [
20 # fix tests with recent versions of git-annex
21 (fetchpatch {
22 url = "https://github.com/alpernebbi/git-annex-adapter/commit/6c210d828e8a57b12c716339ad1bf15c31cd4a55.patch";
23 sha256 = "17kp7pnm9svq9av4q7hfic95xa1w3z02dnr8nmg14sjck2rlmqsi";
24 })
25 (substituteAll {
26 src = ./git-annex-path.patch;
27 gitAnnex = "${git-annex}/bin/git-annex";
28 })
29 ];
30
31 checkInputs = [
32 gitMinimal
33 util-linux # `rev` is needed in tests/test_process.py
34 ];
35
36 propagatedBuildInputs = [ pygit2 cacert ];
37
38 checkPhase = ''
39 ${python.interpreter} -m unittest
40 '';
41 pythonImportsCheck = [ "git_annex_adapter" ];
42
43 meta = with 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}