1{ lib
2, stdenv
3, buildPythonPackage
4, cacert
5, cached-property
6, cffi
7, fetchPypi
8, isPyPy
9, libgit2
10, pycparser
11, pytestCheckHook
12, pythonOlder
13}:
14
15buildPythonPackage rec {
16 pname = "pygit2";
17 version = "1.10.1";
18 format = "setuptools";
19
20 disabled = pythonOlder "3.7";
21
22 src = fetchPypi {
23 inherit pname version;
24 hash = "sha256-NUZRvwYsAtHwgEHW+/GptL96k6/OZZeb3Ai9xlZTqi4=";
25 };
26
27 preConfigure = lib.optionalString stdenv.isDarwin ''
28 export DYLD_LIBRARY_PATH="${libgit2}/lib"
29 '';
30
31 buildInputs = [
32 libgit2
33 ];
34
35 propagatedBuildInputs = [
36 cached-property
37 pycparser
38 ] ++ lib.optionals (!isPyPy) [
39 cffi
40 ];
41
42 propagatedNativeBuildInputs = lib.optionals (!isPyPy) [
43 cffi
44 ];
45
46 checkInputs = [
47 pytestCheckHook
48 ];
49
50 disabledTestPaths = [
51 # Disable tests that require networking
52 "test/test_repository.py"
53 "test/test_credentials.py"
54 "test/test_submodule.py"
55 ];
56
57 # Tests require certificates
58 # https://github.com/NixOS/nixpkgs/pull/72544#issuecomment-582674047
59 SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
60
61 # setup.py check is broken
62 # https://github.com/libgit2/pygit2/issues/868
63 dontUseSetuptoolsCheck = true;
64
65 # TODO: Test collection is failing
66 # https://github.com/NixOS/nixpkgs/pull/72544#issuecomment-582681068
67 doCheck = false;
68
69 pythonImportsCheck = [
70 "pygit2"
71 ];
72
73 meta = with lib; {
74 description = "A set of Python bindings to the libgit2 shared library";
75 homepage = "https://github.com/libgit2/pygit2";
76 license = licenses.gpl2Only;
77 maintainers = with maintainers; [ ];
78 };
79}