diff mbox series

[bug#54396,v6] gnu: python-notmuch2: Fix build.

Message ID 20220322161126.30669-1-tanguy@bioneland.org
State Accepted
Headers show
Series [bug#54396,v6] gnu: python-notmuch2: Fix build. | expand

Commit Message

Tanguy LE CARROUR March 22, 2022, 4:11 p.m. UTC
Hi Liliana,

Sorry, but I didn't find time last week-end to migrate the package
definition to the new style! :-(

But, just in case in would make sense to fix the build before I found
some time to do my homework, here is the patch!

Cheers,

Comments

Liliana Marie Prikler March 23, 2022, 8:15 p.m. UTC | #1
Hi Tanguy,

Am Dienstag, dem 22.03.2022 um 17:11 +0100 schrieb Tanguy Le Carrour:
> Hi Liliana,
> 
> Sorry, but I didn't find time last week-end to migrate the package
> definition to the new style! :-(
> 
> But, just in case in would make sense to fix the build before I found
> some time to do my homework, here is the patch!
> 
> Cheers,
I fixed some minor thing in the copyright line, added my own patch to
use the new style, and pushed both.

Cheers
Tanguy LE CARROUR March 24, 2022, 7:11 a.m. UTC | #2
Hi Liliana,


Quoting Liliana Marie Prikler (2022-03-23 21:15:43)
> Am Dienstag, dem 22.03.2022 um 17:11 +0100 schrieb Tanguy Le Carrour:
> > Hi Liliana,
> > 
> > Sorry, but I didn't find time last week-end to migrate the package
> > definition to the new style! :-(
> > 
> > But, just in case in would make sense to fix the build before I found
> > some time to do my homework, here is the patch!
> > 
> > Cheers,
> I fixed some minor thing in the copyright line, added my own patch to
> use the new style, and pushed both.

Thank you so much!!
The change looks trivial, but some of it still doesn't make sense to me! :-(
I guess I have to improve my Guile skills!

I'll read (again) some of those resources:

- [The Big Change](https://guix.gnu.org/en/blog/2021/the-big-change)
- [G-Expressions](https://guix.gnu.org/manual/en/html_node/G_002dExpressions.html)
- [Guix Programming Interface](https://guix.gnu.org/manual/en/guix.html#Programming-Interface)
- [Guile Manual](https://www.gnu.org/software/guile/manual/guile.html)

If you have any link that could help me become a Guile Jedi, they are
more than welcome! :-)

Cheers,
diff mbox series

Patch

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index d253ca7011..1a11163be6 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, 2020-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 @@  (define-public python-notmuch2
          ;; 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+)))