1{ stdenv, lib, buildPythonPackage, fetchPypi, fetchpatch, isPyPy, libgit2_0_27, six, cffi }:
2
3buildPythonPackage rec {
4 pname = "pygit2";
5 version = "0.27.2";
6
7 src = fetchPypi {
8 inherit pname version;
9 sha256 = "0d9bgxd6ch5jxz0j5cmx7c4kw933g8pgm2zxf3id1a6w9g2r7hpw";
10 };
11
12 preConfigure = lib.optionalString stdenv.isDarwin ''
13 export DYLD_LIBRARY_PATH="${libgit2_0_27}/lib"
14 '';
15
16 patches = [ (fetchpatch {
17 name = "dont-require-old-pycparser"; # https://github.com/libgit2/pygit2/issues/819
18 url = https://github.com/libgit2/pygit2/commit/1eaba181577de206d3d43ec7886d0353fc0c9f2a.patch;
19 sha256 = "18x1fpmywhjjr4lvakwmy34zpxfqi8pqqj48g1wcib39lh3s7l4f";
20 }) ];
21
22 propagatedBuildInputs = [ libgit2_0_27 six ] ++ lib.optional (!isPyPy) cffi;
23
24 preCheck = ''
25 # disable tests that require networking
26 rm test/test_repository.py
27 rm test/test_credentials.py
28 rm test/test_submodule.py
29 '';
30
31 meta = with lib; {
32 description = "A set of Python bindings to the libgit2 shared library";
33 homepage = https://pypi.python.org/pypi/pygit2;
34 license = licenses.gpl2;
35 };
36}