1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 notmuch,
6 python,
7 cffi,
8}:
9
10buildPythonPackage {
11 pname = "notmuch2";
12 format = "setuptools";
13 inherit (notmuch) version src;
14
15 sourceRoot = "notmuch-${notmuch.version}/bindings/python-cffi";
16
17 nativeBuildInputs = [ cffi ];
18 buildInputs = [
19 python
20 notmuch
21 ];
22
23 propagatedBuildInputs = [ cffi ];
24
25 # since notmuch 0.35, this package expects _notmuch_config.py that is
26 # generated by notmuch's configure script. We write one which references our
27 # built libraries.
28 postPatch = ''
29 cat > _notmuch_config.py << EOF
30 import os
31 dir_path = os.path.dirname(os.path.realpath(__file__))
32 NOTMUCH_VERSION_FILE=os.path.join(dir_path, '../../version.txt')
33 NOTMUCH_INCLUDE_DIR='${notmuch.out}/lib'
34 NOTMUCH_LIB_DIR='${notmuch.out}/lib'
35 EOF
36 '';
37
38 # no tests
39 doCheck = false;
40 pythonImportsCheck = [ "notmuch2" ];
41
42 meta = with lib; {
43 description = "Pythonic bindings for the notmuch mail database using CFFI";
44 homepage = "https://notmuchmail.org/";
45 license = licenses.gpl3;
46 maintainers = with maintainers; [ teto ];
47 };
48}