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 (fetchpatch {
26 url = "https://github.com/alpernebbi/git-annex-adapter/commit/b78a8f445f1fb5cf34b28512fc61898ef166b5a1.patch";
27 hash = "sha256-BSVoOPWsgY1btvn68bco4yb90FAC7ay2kYZ+q9qDHHw=";
28 })
29 (fetchpatch {
30 url = "https://github.com/alpernebbi/git-annex-adapter/commit/d0d8905965a3659ce95cbd8f8b1e8598f0faf76b.patch";
31 hash = "sha256-UcRTKzD3sbXGIuxj4JzZDnvjTYyWVkfeWgKiZ1rAlus=";
32 })
33 (substituteAll {
34 src = ./git-annex-path.patch;
35 gitAnnex = "${git-annex}/bin/git-annex";
36 })
37 ];
38
39 nativeCheckInputs = [
40 gitMinimal
41 util-linux # `rev` is needed in tests/test_process.py
42 ];
43
44 propagatedBuildInputs = [ pygit2 cacert ];
45
46 checkPhase = ''
47 ${python.interpreter} -m unittest
48 '';
49 pythonImportsCheck = [ "git_annex_adapter" ];
50
51 meta = with lib; {
52 homepage = "https://github.com/alpernebbi/git-annex-adapter";
53 description = "Call git-annex commands from Python";
54 license = licenses.gpl3Plus;
55 maintainers = with maintainers; [ dotlambda ];
56 };
57}