nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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 (substituteAll {
30 src = ./git-annex-path.patch;
31 gitAnnex = "${git-annex}/bin/git-annex";
32 })
33 ];
34
35 checkInputs = [
36 gitMinimal
37 util-linux # `rev` is needed in tests/test_process.py
38 ];
39
40 propagatedBuildInputs = [ pygit2 cacert ];
41
42 checkPhase = ''
43 ${python.interpreter} -m unittest
44 '';
45 pythonImportsCheck = [ "git_annex_adapter" ];
46
47 meta = with lib; {
48 homepage = "https://github.com/alpernebbi/git-annex-adapter";
49 description = "Call git-annex commands from Python";
50 license = licenses.gpl3Plus;
51 maintainers = with maintainers; [ dotlambda ];
52 };
53}