1{
2 lib,
3 buildPythonPackage,
4 cacert,
5 fetchFromGitHub,
6 fetchpatch,
7 git-annex,
8 gitMinimal,
9 pygit2,
10 pytestCheckHook,
11 python,
12 pythonOlder,
13 setuptools,
14 substituteAll,
15 util-linux,
16}:
17
18buildPythonPackage rec {
19 pname = "git-annex-adapter";
20 version = "0.2.2";
21 pyproject = true;
22
23 disabled = pythonOlder "3.7";
24
25 src = fetchFromGitHub {
26 owner = "alpernebbi";
27 repo = "git-annex-adapter";
28 rev = "refs/tags/v${version}";
29 hash = "sha256-vb0vxnwAs0/yOjpyyoGWvX6Tu+cuziGNdnXbdzXexhg=";
30 };
31
32 patches = [
33 # fix tests with recent versions of git-annex
34 (fetchpatch {
35 url = "https://github.com/alpernebbi/git-annex-adapter/commit/6c210d828e8a57b12c716339ad1bf15c31cd4a55.patch";
36 sha256 = "17kp7pnm9svq9av4q7hfic95xa1w3z02dnr8nmg14sjck2rlmqsi";
37 })
38 (fetchpatch {
39 url = "https://github.com/alpernebbi/git-annex-adapter/commit/b78a8f445f1fb5cf34b28512fc61898ef166b5a1.patch";
40 hash = "sha256-BSVoOPWsgY1btvn68bco4yb90FAC7ay2kYZ+q9qDHHw=";
41 })
42 (fetchpatch {
43 url = "https://github.com/alpernebbi/git-annex-adapter/commit/d0d8905965a3659ce95cbd8f8b1e8598f0faf76b.patch";
44 hash = "sha256-UcRTKzD3sbXGIuxj4JzZDnvjTYyWVkfeWgKiZ1rAlus=";
45 })
46 (substituteAll {
47 src = ./git-annex-path.patch;
48 gitAnnex = "${git-annex}/bin/git-annex";
49 })
50 ];
51
52 nativeBuildInputs = [ setuptools ];
53
54 propagatedBuildInputs = [
55 pygit2
56 cacert
57 ];
58
59 nativeCheckInputs = [
60 gitMinimal
61 util-linux # `rev` is needed in tests/test_process.py
62 pytestCheckHook
63 ];
64
65 pythonImportsCheck = [ "git_annex_adapter" ];
66
67 disabledTests = [
68 # KeyError and AssertionError
69 "test_jsonprocess_annex_metadata_batch"
70 "test_process_annex_metadata_batch"
71 "test_batchjson_metadata"
72 ];
73
74 meta = with lib; {
75 homepage = "https://github.com/alpernebbi/git-annex-adapter";
76 description = "Call git-annex commands from Python";
77 license = licenses.gpl3Plus;
78 maintainers = with maintainers; [ dotlambda ];
79 };
80}