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