about summary refs log tree commit diff
path: root/pkgs/development/python-modules/git-annex-adapter/default.nix
blob: 6cb6e626f279f4691238aa912fc1c67b19147f97 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{ stdenv, buildPythonPackage, isPy3k, fetchFromGitHub, fetchpatch
, utillinux, pygit2, gitMinimal, git-annex
}:

buildPythonPackage rec {
  pname = "git-annex-adapter";
  version = "0.2.0";

  disabled = !isPy3k;

  # There is only a wheel on PyPI - build from source instead
  src = fetchFromGitHub {
    owner = "alpernebbi";
    repo = pname;
    rev = "v${version}";
    sha256 = "1sbgp4ivgw4m8nngrlb1f78xdnssh639c1khv4z98753w3sdsxdz";
  };

  prePatch = ''
    substituteInPlace git_annex_adapter/process.py \
      --replace "'git', 'annex'" "'${git-annex}/bin/git-annex'" \
      --replace "'git-annex'" "'${git-annex}/bin/git-annex'"
  '';

  # TODO: Remove for next version
  patches = [
    ./not-a-git-repo-testcase.patch
    (fetchpatch {
      url = "https://github.com/alpernebbi/git-annex-adapter/commit/9f64c4b99cae7b681820c6c7382e1e40489f4d1e.patch";
      sha256 = "0yh66gial6bx7kbl7s7lkzljnkpgvgr8yahqqcq9z76d0w752dir";
    })
  ];

  checkInputs = [
    utillinux # `rev` is needed in tests/test_process.py
  ];

  propagatedBuildInputs = [ pygit2 gitMinimal ];

  buildInputs = [ git-annex ];

  checkPhase = ''
    python -m unittest
  '';

  meta = with stdenv.lib; {
    homepage = https://github.com/alpernebbi/git-annex-adapter;
    description = "Call git-annex commands from Python";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ dotlambda ma27 ];
  };
}