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.13.0";
18 format = "setuptools";
19
20 disabled = pythonOlder "3.7";
21
22 src = fetchPypi {
23 inherit pname version;
24 hash = "sha256-bd43Q2+rFCZK09bLxarj/VVeualoCnv91uVkzXe14rg=";
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 nativeCheckInputs = [
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 pythonImportsCheck = [
62 "pygit2"
63 ];
64
65 meta = with lib; {
66 description = "A set of Python bindings to the libgit2 shared library";
67 homepage = "https://github.com/libgit2/pygit2";
68 license = licenses.gpl2Only;
69 maintainers = with maintainers; [ ];
70 };
71}