all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tanguy LE CARROUR <tanguy@bioneland.org>
To: Liliana Marie Prikler <liliana.prikler@ist.tugraz.at>
Cc: 54396@debbugs.gnu.org
Subject: [bug#54396] [PATCH v2] [WIP] gnu: python-notmuch2: Fix build.
Date: Wed, 16 Mar 2022 17:48:31 +0100	[thread overview]
Message-ID: <164744931122.17491.16594765317356733408@localhost> (raw)
In-Reply-To: <dedb71674069cd5227d82625a879400ce95e80c9.camel@ist.tugraz.at>

[-- Attachment #1: Type: text/plain, Size: 2042 bytes --]

Hi Liliana,


Quoting Liliana Marie Prikler (2022-03-16 15:02:30)
> Am Mittwoch, dem 16.03.2022 um 14:46 +0100 schrieb Tanguy LE CARROUR:
> > > i.e. (dirname (search-input-file inputs "notmuch.h")) and
> > > (dirname (search-input-file inputs "libnotmuch.so")).
> > 
> > Unfortunately, I couldn't make those work. :-(
> > 
> > So I ended up with a less "sexy" version:
> > 
> > ```
> > "NOTMUCH_INCLUDE_DIR='" (assoc-ref inputs "notmuch")
> > "/include/notmuch.h" "'\n"
> > "NOTMUCH_LIB_DIR='" (assoc-ref inputs "notmuch") "/lib/libnotmuch.so"
> > "'"
> > ```
> That is actually a mistake on my part, search-input-file should search
> inputs for "include/notmuch.h" and likewise "lib/libnotmuch.so".  The
> dirname is important here, since both constants want directories. 
> Alternatively, forgoing those constants might be a good idea, but is
> not worth investing too much time in.

So, I'm leaving those as they are for now.


> > If I set `NOTMUCH_VERSION_FILE=''`, I get a "file does not exist"
> > error at build time. So I decided to set it to `/dev/null` instead.
> > Or would it be better if I patched `notmuch` to create the actual
> > version file?!
> I think you ought to debug the build and short-circuit the logic by
> inferring the version number directly where it is needed.  Without
> actual build output that's as much as I can propose.

Mmm… I've added a new phase to patch the `setup.py`, but couldn't get
the version variable to work. Sorry for my… noobiness!? ^_^'

```
;; 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"
      (("with open\\(NOTMUCH_VERSION_FILE\\) as fp:") "")
      (("    VERSION = fp.read\\(\\).strip\\(\\)") "")
      (("version=VERSION,") (string-append "version='" "0.0.0" "',")))))
```

I've tried to replace `0.0.0` with `version` or `,version` but that
doesn't seem to be the proper way to do it.

Regards,

-- 
Tanguy

[-- Attachment #2: 0001-WIP-gnu-python-notmuch2-Fix-build.patch --]
[-- Type: text/x-diff, Size: 2742 bytes --]

From 590bfced58815504ed7ed71f8832107b6e0980c0 Mon Sep 17 00:00:00 2001
From: Tanguy Le Carrour <tanguy@bioneland.org>
Date: Tue, 15 Mar 2022 10:38:14 +0100
Subject: [PATCH v4] [WIP] gnu: python-notmuch2: Fix build.

* gnu/packages/mail.scm (python-notmuch2):
(%standard-phases): Add 'create-notmuch-config' and 'patch-setup.py'
after 'enter-python-dir'.
---
 gnu/packages/mail.scm | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index d253ca7011..2ad60e595c 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,26 @@ (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="
+                   "'" (assoc-ref inputs "notmuch") "/include/notmuch.h" "'\n"
+                   "NOTMUCH_LIB_DIR="
+                   "'" (assoc-ref inputs "notmuch") "/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"
+               (("with open\\(NOTMUCH_VERSION_FILE\\) as fp:") "")
+               (("    VERSION = fp.read\\(\\).strip\\(\\)") "")
+               (("version=VERSION,") (string-append "version='" "0.0.0" "',"))))))))
     (synopsis "Pythonic bindings for the notmuch mail database using CFFI")
     (license license:gpl3+)))
 
-- 
2.34.0


  reply	other threads:[~2022-03-16 16:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-15  9:38 [bug#54396] [PATCH] [WIP] gnu: python-notmuch2: Fix build Tanguy Le Carrour
2022-03-15 10:11 ` Liliana Marie Prikler
2022-03-15 10:58   ` Tanguy LE CARROUR
2022-03-15 16:04 ` Maxime Devos
2022-03-16  7:57   ` Tanguy LE CARROUR
2022-03-16 11:16 ` [bug#54396] [PATCH v2] " Tanguy Le Carrour
2022-03-16 11:28   ` Liliana Marie Prikler
2022-03-16 13:46     ` Tanguy LE CARROUR
2022-03-16 14:02       ` Liliana Marie Prikler
2022-03-16 16:48         ` Tanguy LE CARROUR [this message]
2022-03-17  6:59           ` Liliana Marie Prikler
2022-03-17  9:43             ` Tanguy LE CARROUR
2022-03-17  9:51               ` Liliana Marie Prikler
2022-03-17 17:32                 ` Tanguy LE CARROUR
2022-03-22 16:11 ` [bug#54396] [PATCH v6] " Tanguy Le Carrour
2022-03-23 20:15   ` bug#54396: " Liliana Marie Prikler
2022-03-24  7:11     ` [bug#54396] " Tanguy LE CARROUR

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=164744931122.17491.16594765317356733408@localhost \
    --to=tanguy@bioneland.org \
    --cc=54396@debbugs.gnu.org \
    --cc=liliana.prikler@ist.tugraz.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.