1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 cacert,
6 cached-property,
7 cffi,
8 fetchPypi,
9 isPyPy,
10 libgit2,
11 pycparser,
12 pytestCheckHook,
13 pythonOlder,
14 setuptools,
15}:
16
17buildPythonPackage rec {
18 pname = "pygit2";
19 version = "1.18.2";
20 pyproject = true;
21
22 disabled = pythonOlder "3.9";
23
24 src = fetchPypi {
25 inherit pname version;
26 hash = "sha256-7Kh+BmLJZXFbfxNJHV6FjfLAkINB3um94rwDJo5GD1U=";
27 };
28
29 preConfigure = lib.optionalString stdenv.hostPlatform.isDarwin ''
30 export DYLD_LIBRARY_PATH="${libgit2}/lib"
31 '';
32
33 build-system = [ setuptools ];
34
35 buildInputs = [ libgit2 ];
36
37 dependencies = [
38 cached-property
39 pycparser
40 ]
41 ++ lib.optionals (!isPyPy) [ cffi ];
42
43 propagatedNativeBuildInputs = lib.optionals (!isPyPy) [ cffi ];
44
45 nativeCheckInputs = [ pytestCheckHook ];
46
47 disabledTestPaths = [
48 # Disable tests that require networking
49 "test/test_repository.py"
50 "test/test_credentials.py"
51 "test/test_submodule.py"
52 ];
53
54 # Tests require certificates
55 # https://github.com/NixOS/nixpkgs/pull/72544#issuecomment-582674047
56 SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
57
58 pythonImportsCheck = [ "pygit2" ];
59
60 meta = with lib; {
61 description = "Set of Python bindings to the libgit2 shared library";
62 homepage = "https://github.com/libgit2/pygit2";
63 changelog = "https://github.com/libgit2/pygit2/blob/v${version}/CHANGELOG.md";
64 license = licenses.gpl2Only;
65 maintainers = [ ];
66 };
67}