summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanguy Le Carrour <tanguy@bioneland.org>2022-03-22 17:11:26 +0100
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2022-03-23 21:07:00 +0100
commit8d33d7b42f0c676beebfa38bd45e682f6958c17f (patch)
tree65355f96dfcbe16635ade8e435455e5c4cb2611d
parent9a31942cabb5c73174aee96ecd873fcf89955a9d (diff)
downloadguix-8d33d7b42f0c676beebfa38bd45e682f6958c17f.tar.gz
gnu: python-notmuch2: Fix build.
* gnu/packages/mail.scm (python-notmuch2)[#:phases]: Add
‘create-notmuch-config’ and ‘patch-setup.’py after ‘enter-python-dir’.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
-rw-r--r--gnu/packages/mail.scm24
1 files changed, 22 insertions, 2 deletions
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index d253ca7011..6380412330 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -28,7 +28,7 @@
 ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
 ;;; Copyright © 2018 Gábor Boskovits <boskovits@gmail.com>
 ;;; Copyright © 2018, 2019, 2020, 2021, 2022 Ricardo Wurmus <rekado@elephly.net>
-;;; Copyright © 2019, 2020, 2021 Tanguy Le Carrour <tanguy@bioneland.org>
+;;; Copyright © 2019–2022 Tanguy Le Carrour <tanguy@bioneland.org>
 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
 ;;; Copyright © 2020 Justus Winter <justus@sequoia-pgp.org>
 ;;; Copyright © 2020 Eric Brown <ecbrown@ericcbrown.com>
@@ -1493,7 +1493,27 @@ and search library.")
          ;; This python package lives in a subdirectory of the notmuch source
          ;; tree, so chdir into it before building.
          (add-after 'unpack 'enter-python-dir
-           (lambda _ (chdir "bindings/python-cffi"))))))
+           (lambda _ (chdir "bindings/python-cffi")))
+         ;; python-build-system does not invoke the configure script
+         ;; so _notmuch_config.py is missing
+         (add-after 'enter-python-dir 'create-notmuch-config
+           (lambda* (#:key inputs #:allow-other-keys)
+             (with-output-to-file "_notmuch_config.py"
+               (lambda _
+                 (display
+                  (string-append
+                   "NOTMUCH_INCLUDE_DIR="
+                   "'" (dirname (search-input-file inputs "include/notmuch.h")) "'\n"
+                   "NOTMUCH_LIB_DIR="
+                   "'" (dirname (search-input-file inputs "lib/libnotmuch.so")) "'"))))))
+         ;; version.txt is not included in notmuch, so we patch in the version number
+         (add-after 'create-notmuch-config 'patch-setup.py
+           (lambda _
+             (substitute* "setup.py"
+               (("NOTMUCH_VERSION_FILE")
+                "'/dev/null'")
+               (("version=VERSION,")
+                (string-append "version='" ,(package-version this-package) "',"))))))))
     (synopsis "Pythonic bindings for the notmuch mail database using CFFI")
     (license license:gpl3+)))