1{ stdenv, lib, buildPythonPackage, fetchPypi, isPyPy, isPy3k, libgit2, cached-property, pytestCheckHook, cffi, cacert }:
2
3buildPythonPackage rec {
4 pname = "pygit2";
5 version = "1.2.1";
6
7 src = fetchPypi {
8 inherit pname version;
9 sha256 = "11q3a0p4mvzdskla0c6ffcrddldfbh7dc4p5l6xrriwri88j356y";
10 };
11
12 preConfigure = lib.optionalString stdenv.isDarwin ''
13 export DYLD_LIBRARY_PATH="${libgit2}/lib"
14 '';
15
16 buildInputs = [
17 libgit2
18 ];
19
20 propagatedBuildInputs = [
21 cached-property
22 ] ++ lib.optional (!isPyPy) cffi;
23
24 checkInputs = [ pytestCheckHook ];
25
26 preCheck = ''
27 # disable tests that require networking
28 rm test/test_repository.py
29 rm test/test_credentials.py
30 rm test/test_submodule.py
31 '';
32
33 # Tests require certificates
34 # https://github.com/NixOS/nixpkgs/pull/72544#issuecomment-582674047
35 SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
36
37 # setup.py check is broken
38 # https://github.com/libgit2/pygit2/issues/868
39 dontUseSetuptoolsCheck = true;
40
41 # TODO: Test collection is failing
42 # https://github.com/NixOS/nixpkgs/pull/72544#issuecomment-582681068
43 doCheck = false;
44
45 disabled = !isPy3k;
46
47 meta = with lib; {
48 description = "A set of Python bindings to the libgit2 shared library";
49 homepage = "https://pypi.python.org/pypi/pygit2";
50 license = licenses.gpl2;
51 };
52}