all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#54396] [PATCH] [WIP] gnu: python-notmuch2: Fix build.
@ 2022-03-15  9:38 Tanguy Le Carrour
  2022-03-15 10:11 ` Liliana Marie Prikler
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Tanguy Le Carrour @ 2022-03-15  9:38 UTC (permalink / raw)
  To: 54396; +Cc: Tanguy Le Carrour

Hi Guix,

I'm (still) trying to fix a build failure I (unsuccessfully) reported
here: <https://lists.gnu.org/archive/html/guix-devel/2022-02/msg00302.html>.

I've tried and produced a patch, but, somehow, I cannot make it work! :-(

```
+               (setenv "SHELL" (which "sh"))
+               (setenv "CONFIG_SHELL" (which "sh"))
```

I'm not sure those lines are required, but at this point I've just
copied/pasted code I found in an other package definition.


```
+               ;(invoke "./configure" (string-append "--prefix=" out)))))
+               (invoke "bash" "./configure" (string-append "--prefix=" out)))))
```

If I "just" invoke `./configure` I get an error code, but no error
message. I had to prepend `bash` to get the error message telling me
that `cc` and `gcc` were missing.


```
+  #:use-module (gnu packages commencement)
; […]
+    (native-inputs (list gcc-toolchain))
```

When I add `#:use-module (gnu packages commencement)` I get the following error
message I cannot decipher:

```
error: tcc: unbound variable
hint: Did you forget a `use-modules' form?

error: googletest: unbound variable
hint: Did you forget a `use-modules' form?

; […]

Throw to key `unbound-variable' with args `("resolve-interface" "no binding `~A' in module ~A" (python (gnu packages python)) #f)'.
Backtrace:
In guix/store.scm:
   658:37 19 (thunk)
   1320:8 18 (call-with-build-handler #<procedure 7f3d04dabb70 at g…> …)
In guix/scripts/build.scm:
    499:2 17 (_)
In srfi/srfi-1.scm:
   673:15 16 (append-map _ _ . _)
   586:17 15 (map1 ((argument . "python-notmuch2") (build-mode . 0) …))
In guix/scripts/build.scm:
   519:31 14 (_ _)
In gnu/packages.scm:
    478:2 13 (%find-package "python-notmuch2" "python-notmuch2" #f)
    363:6 12 (find-best-packages-by-name _ _)
   293:56 11 (_ "python-notmuch2" _)
In unknown file:
          10 (force #<promise #<procedure 7f3d04634060 at gnu/packag…>)
In gnu/packages.scm:
   240:33  9 (fold-packages #<procedure 7f3d03cb34a8 at gnu/package…> …)
In guix/discovery.scm:
   159:11  8 (all-modules _ #:warn _)
In srfi/srfi-1.scm:
   460:18  7 (fold #<procedure 7f3d072f41e0 at guix/discovery.scm:1…> …)
In guix/discovery.scm:
   149:19  6 (_ _ ())
    116:5  5 (scheme-modules _ _ #:warn _)
In srfi/srfi-1.scm:
   691:23  4 (filter-map #<procedure 7f3d072f7f00 at guix/discove…> . #)
In guix/discovery.scm:
   124:24  3 (_ . _)
In guix/ui.scm:
    325:2  2 (report-unbound-variable-error _ #:frame _)
In ice-9/boot-9.scm:
  1685:16  1 (raise-exception _ #:continuable? _)
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Throw to key `match-error' with args `("match" "no matching pattern" (unbound-variable "resolve-interface" "no binding `~A' in module ~A" (python (gnu packages python)) #f))'.
```

Any advice welcome!

Regards,

-- 
Tanguy


---
 gnu/packages/mail.scm | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index d253ca7011..e7cf07944d 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>
@@ -75,6 +75,7 @@ (define-module (gnu packages mail)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages calendar)
   #:use-module (gnu packages check)
+  #:use-module (gnu packages commencement)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages crypto)
   #:use-module (gnu packages curl)
@@ -1486,14 +1487,24 @@ (define-public python-notmuch2
   (package
     (inherit python-notmuch)
     (name "python-notmuch2")
-    (propagated-inputs (list python-cffi))
     (arguments
      `(#:phases
        (modify-phases %standard-phases
+         ;; configure generates `bindings/python-cffi/_notmuch_config.py`
+         ;; https://git.notmuchmail.org/git?p=notmuch;a=commit;h=7b5921877e748338359a25dae578771f768183af
+         (add-after 'unpack 'run-configure
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (setenv "SHELL" (which "sh"))
+               (setenv "CONFIG_SHELL" (which "sh"))
+               ;(invoke "./configure" (string-append "--prefix=" out)))))
+               (invoke "bash" "./configure" (string-append "--prefix=" out)))))
          ;; This python package lives in a subdirectory of the notmuch source
          ;; tree, so chdir into it before building.
-         (add-after 'unpack 'enter-python-dir
+         (add-after 'run-configure 'enter-python-dir
            (lambda _ (chdir "bindings/python-cffi"))))))
+    (native-inputs (list gcc-toolchain))
+    (propagated-inputs (list python-cffi))
     (synopsis "Pythonic bindings for the notmuch mail database using CFFI")
     (license license:gpl3+)))
 
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [bug#54396] [PATCH] [WIP] gnu: python-notmuch2: Fix build.
  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
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 17+ messages in thread
From: Liliana Marie Prikler @ 2022-03-15 10:11 UTC (permalink / raw)
  To: Tanguy Le Carrour, 54396

Hi Tanguy,

Am Dienstag, dem 15.03.2022 um 10:38 +0100 schrieb Tanguy Le Carrour:
> Hi Guix,
> 
> I'm (still) trying to fix a build failure I (unsuccessfully) reported
> here:
> <https://lists.gnu.org/archive/html/guix-devel/2022-02/msg00302.html>
> .
> 
> I've tried and produced a patch, but, somehow, I cannot make it work!
> :-(
> 
> ```
> +               (setenv "SHELL" (which "sh"))
> +               (setenv "CONFIG_SHELL" (which "sh"))
> ```
> 
> I'm not sure those lines are required, but at this point I've just
> copied/pasted code I found in an other package definition.
> 
> 
> ```
> +               ;(invoke "./configure" (string-append "--prefix="
> out)))))
> +               (invoke "bash" "./configure" (string-append "--
> prefix=" out)))))
> ```
> 
> If I "just" invoke `./configure` I get an error code, but no error
> message. I had to prepend `bash` to get the error message telling me
> that `cc` and `gcc` were missing.
Instead of running configure, I suggest generating the
_notmuch_config.py on your own.  There are three variables you need to
define at the moment: NOTMUCH_INCLUDE_DIR and NOTMUCH_LIB_DIR need to
point to the already built notmuch, not the one being currently
unpacked, and NOTMUCH_VERSION_FILE can also point to an installed file
if possible; otherwise generate a dummy.

> ```
> +  #:use-module (gnu packages commencement)
> ; […]
> +    (native-inputs (list gcc-toolchain))
> ```
> 
> When I add `#:use-module (gnu packages commencement)` I get the
> following error
> message I cannot decipher:
> 
> ```
> error: tcc: unbound variable
> hint: Did you forget a `use-modules' form?
> 
> error: googletest: unbound variable
> hint: Did you forget a `use-modules' form?
Such cascading error chains typically happen when a package is
malformed and the module it's in can't be compiled.  I'm not sure if
that's your fault or someone messed with the python module, but either
way, you shouldn't use gcc-toolchain for package definitions regardless
of whether it causes an error or not.  It is solely meant for users to
not complain that "gcc doesn't work!!!111!1!einself!" when installing
it into their profiles.


Cheers




^ permalink raw reply	[flat|nested] 17+ messages in thread

* [bug#54396] [PATCH] [WIP] gnu: python-notmuch2: Fix build.
  2022-03-15 10:11 ` Liliana Marie Prikler
@ 2022-03-15 10:58   ` Tanguy LE CARROUR
  0 siblings, 0 replies; 17+ messages in thread
From: Tanguy LE CARROUR @ 2022-03-15 10:58 UTC (permalink / raw)
  To: 54396, Liliana Marie Prikler

Hi Liliana,

Thanks for reviewing!


Quoting Liliana Marie Prikler (2022-03-15 11:11:14)
> Am Dienstag, dem 15.03.2022 um 10:38 +0100 schrieb Tanguy Le Carrour:
> > I'm (still) trying to fix a build failure I (unsuccessfully) reported
> > here:
> > <https://lists.gnu.org/archive/html/guix-devel/2022-02/msg00302.html>
> > .
> > 
> > I've tried and produced a patch, but, somehow, I cannot make it work!
> > :-(
> > 
> > ```
> > +               (setenv "SHELL" (which "sh"))
> > +               (setenv "CONFIG_SHELL" (which "sh"))
> > ```
> > 
> > I'm not sure those lines are required, but at this point I've just
> > copied/pasted code I found in an other package definition.
> > 
> > 
> > ```
> > +               ;(invoke "./configure" (string-append "--prefix="
> > out)))))
> > +               (invoke "bash" "./configure" (string-append "--
> > prefix=" out)))))
> > ```
> > 
> > If I "just" invoke `./configure` I get an error code, but no error
> > message. I had to prepend `bash` to get the error message telling me
> > that `cc` and `gcc` were missing.
> Instead of running configure, I suggest generating the
> _notmuch_config.py on your own.  There are three variables you need to
> define at the moment: NOTMUCH_INCLUDE_DIR and NOTMUCH_LIB_DIR need to
> point to the already built notmuch, not the one being currently
> unpacked, and NOTMUCH_VERSION_FILE can also point to an installed file
> if possible; otherwise generate a dummy.

Oh… oh… that's a brilliant idea, actually! How stupid of me not to have
thought about it right away!! ^_^'
Thaaaanks! I'll do that!


> > ```
> > +  #:use-module (gnu packages commencement)
> > ; […]
> > +    (native-inputs (list gcc-toolchain))
> > ```
> > 
> > When I add `#:use-module (gnu packages commencement)` I get the
> > following error
> > message I cannot decipher:
> > 
> > ```
> > error: tcc: unbound variable
> > hint: Did you forget a `use-modules' form?
> > 
> > error: googletest: unbound variable
> > hint: Did you forget a `use-modules' form?
> Such cascading error chains typically happen when a package is
> malformed and the module it's in can't be compiled.  I'm not sure if
> that's your fault or someone messed with the python module, but either
> way, you shouldn't use gcc-toolchain for package definitions regardless
> of whether it causes an error or not.  It is solely meant for users to
> not complain that "gcc doesn't work!!!111!1!einself!" when installing
> it into their profiles.

Ok, good to know. Thanks!


Regards,

-- 
Tanguy




^ permalink raw reply	[flat|nested] 17+ messages in thread

* [bug#54396] [PATCH] [WIP] gnu: python-notmuch2: Fix build.
  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 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-22 16:11 ` [bug#54396] [PATCH v6] " Tanguy Le Carrour
  3 siblings, 1 reply; 17+ messages in thread
From: Maxime Devos @ 2022-03-15 16:04 UTC (permalink / raw)
  To: Tanguy Le Carrour, 54396

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

Tanguy Le Carrour schreef op di 15-03-2022 om 10:38 [+0100]:
> When I add `#:use-module (gnu packages commencement)`

From (gnu packages commencement):

> ;;; To avoid circular dependencies, this module should not be
> imported
> ;;; directly from anywhere.

if it still needs to be used, you could look at how gnu-build-system
sort-of imports it anyway, indirectly.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [bug#54396] [PATCH] [WIP] gnu: python-notmuch2: Fix build.
  2022-03-15 16:04 ` Maxime Devos
@ 2022-03-16  7:57   ` Tanguy LE CARROUR
  0 siblings, 0 replies; 17+ messages in thread
From: Tanguy LE CARROUR @ 2022-03-16  7:57 UTC (permalink / raw)
  To: 54396, Maxime Devos

Hi Maxime,


Quoting Maxime Devos (2022-03-15 17:04:19)
> Tanguy Le Carrour schreef op di 15-03-2022 om 10:38 [+0100]:
> > When I add `#:use-module (gnu packages commencement)`
> 
> From (gnu packages commencement):
> 
> > ;;; To avoid circular dependencies, this module should not be
> > imported
> > ;;; directly from anywhere.
> 
> if it still needs to be used, you could look at how gnu-build-system
> sort-of imports it anyway, indirectly.

A well-deserved RT*M! :-)
Thanks for pointing at! In my defence, I still haven't figured out how
to configure "go to definition" in my Emacs (works for Python, though!),
so navigating the code is still a bit painful.
…Yeah, I know, it's a lame excuse! ^_^'

Regards,

-- 
Tanguy




^ permalink raw reply	[flat|nested] 17+ messages in thread

* [bug#54396] [PATCH v2] [WIP] gnu: python-notmuch2: Fix build.
  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 16:04 ` Maxime Devos
@ 2022-03-16 11:16 ` Tanguy Le Carrour
  2022-03-16 11:28   ` Liliana Marie Prikler
  2022-03-22 16:11 ` [bug#54396] [PATCH v6] " Tanguy Le Carrour
  3 siblings, 1 reply; 17+ messages in thread
From: Tanguy Le Carrour @ 2022-03-16 11:16 UTC (permalink / raw)
  To: liliana.prikler; +Cc: Tanguy Le Carrour, 54396

Hi Liliana,

Did you have something along these lines in mind?

I wanted to add the `create-notmuch-config` phase after the `enter-python-dir`,
but I don't know how to get the source folder from there. I suppose
there's a way to get the `../../` of the `cwd`, but I don't (yet) know how.

The generated contains the expected paths:

```
NOTMUCH_VERSION_FILE='/tmp/guix-build-python-notmuch2-0.35.drv-0/notmuch-0.35/version.txt'
NOTMUCH_INCLUDE_DIR='/tmp/guix-build-python-notmuch2-0.35.drv-0/notmuch-0.35/lib'
NOTMUCH_LIB_DIR='/tmp/guix-build-python-notmuch2-0.35.drv-0/notmuch-0.35/lib'
```

… but they **always** reference `drv-0`, even if it's not the first build!?
For instance:

```
$ cat /tmp/guix-build-python-notmuch2-0.35.drv-6/notmuch-0.35/bindings/python-cffi/_notmuch_config.py                                                                                                                      [profile] guix-dev
NOTMUCH_VERSION_FILE='/tmp/guix-build-python-notmuch2-0.35.drv-0/notmuch-0.35/version.txt'
NOTMUCH_INCLUDE_DIR='/tmp/guix-build-python-notmuch2-0.35.drv-0/notmuch-0.35/lib'
NOTMUCH_LIB_DIR='/tmp/guix-build-python-notmuch2-0.35.drv-0/notmuch-0.35/lib'
```

Does it matter?!

Regards,

--
Tanguy
---
 gnu/packages/mail.scm | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index d253ca7011..f6769cad02 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>
@@ -1490,9 +1490,21 @@ (define-public python-notmuch2
     (arguments
      `(#:phases
        (modify-phases %standard-phases
+         ;; configure generates `bindings/python-cffi/_notmuch_config.py`
+         ;; https://git.notmuchmail.org/git?p=notmuch;a=commit;h=7b5921877e748338359a25dae578771f768183af
+         (add-after 'unpack 'create-notmuch-config
+           (lambda _
+             (let ((cwd (getcwd)))
+               (with-output-to-file "bindings/python-cffi/_notmuch_config.py"
+                 (lambda _
+                   (display
+                    (string-append
+                     "NOTMUCH_VERSION_FILE='" cwd "/version.txt'\n"
+                     "NOTMUCH_INCLUDE_DIR='" cwd "/lib'\n"
+                     "NOTMUCH_LIB_DIR='" cwd "/lib'")))))))
          ;; This python package lives in a subdirectory of the notmuch source
          ;; tree, so chdir into it before building.
-         (add-after 'unpack 'enter-python-dir
+         (add-after 'create-notmuch-config 'enter-python-dir
            (lambda _ (chdir "bindings/python-cffi"))))))
     (synopsis "Pythonic bindings for the notmuch mail database using CFFI")
     (license license:gpl3+)))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [bug#54396] [PATCH v2] [WIP] gnu: python-notmuch2: Fix build.
  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
  0 siblings, 1 reply; 17+ messages in thread
From: Liliana Marie Prikler @ 2022-03-16 11:28 UTC (permalink / raw)
  To: Tanguy Le Carrour; +Cc: 54396

Am Mittwoch, dem 16.03.2022 um 12:16 +0100 schrieb Tanguy Le Carrour:
> Hi Liliana,
> 
> Did you have something along these lines in mind?
> 
> I wanted to add the `create-notmuch-config` phase after the `enter-
> python-dir`,
> but I don't know how to get the source folder from there. I suppose
> there's a way to get the `../../` of the `cwd`, but I don't (yet)
> know how.
> 
> The generated contains the expected paths:
> 
> ```
> NOTMUCH_VERSION_FILE='/tmp/guix-build-python-notmuch2-0.35.drv-
> 0/notmuch-0.35/version.txt'
> NOTMUCH_INCLUDE_DIR='/tmp/guix-build-python-notmuch2-0.35.drv-
> 0/notmuch-0.35/lib'
> NOTMUCH_LIB_DIR='/tmp/guix-build-python-notmuch2-0.35.drv-0/notmuch-
> 0.35/lib'
> ```
> 
> … but they **always** reference `drv-0`, even if it's not the first
> build!?
> For instance:
> 
> ```
> $ cat /tmp/guix-build-python-notmuch2-0.35.drv-6/notmuch-
> 0.35/bindings/python-
> cffi/_notmuch_config.py                                              
>                                                                      
>    [profile] guix-dev
> NOTMUCH_VERSION_FILE='/tmp/guix-build-python-notmuch2-0.35.drv-
> 0/notmuch-0.35/version.txt'
> NOTMUCH_INCLUDE_DIR='/tmp/guix-build-python-notmuch2-0.35.drv-
> 0/notmuch-0.35/lib'
> NOTMUCH_LIB_DIR='/tmp/guix-build-python-notmuch2-0.35.drv-0/notmuch-
> 0.35/lib'
> ```
> 
> Does it matter?!
Yes, it does matter.  The cwd you reference will no longer exist when
the bindings are installed.  The purpose of generating the file is to
fill it with useful, persisting data, i.e. (dirname (search-input-file
inputs "notmuch.h")) and (dirname (search-input-file inputs
"libnotmuch.so")).  As for the version file, that should probably be
set to an error value such as None or NotImplemented or even unset.  It
does not appear to be currently used and we don't install any such file
for notmuch.

Cheers




^ permalink raw reply	[flat|nested] 17+ messages in thread

* [bug#54396] [PATCH v2] [WIP] gnu: python-notmuch2: Fix build.
  2022-03-16 11:28   ` Liliana Marie Prikler
@ 2022-03-16 13:46     ` Tanguy LE CARROUR
  2022-03-16 14:02       ` Liliana Marie Prikler
  0 siblings, 1 reply; 17+ messages in thread
From: Tanguy LE CARROUR @ 2022-03-16 13:46 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 54396

Hi Liliana,


Quoting Liliana Marie Prikler (2022-03-16 12:28:49)
> Am Mittwoch, dem 16.03.2022 um 12:16 +0100 schrieb Tanguy Le Carrour:
> > The generated contains the expected paths:
> > […]
> > 
> > … but they **always** reference `drv-0`, even if it's not the first
> > build!?
> > For instance:
> > 
> > ```
> > $ cat /tmp/guix-build-python-notmuch2-0.35.drv-6/notmuch-
> > 0.35/bindings/python-
> > cffi/_notmuch_config.py
> > NOTMUCH_VERSION_FILE='/tmp/guix-build-python-notmuch2-0.35.drv-
> > 0/notmuch-0.35/version.txt'
> > NOTMUCH_INCLUDE_DIR='/tmp/guix-build-python-notmuch2-0.35.drv-
> > 0/notmuch-0.35/lib'
> > NOTMUCH_LIB_DIR='/tmp/guix-build-python-notmuch2-0.35.drv-0/notmuch-
> > 0.35/lib'
> > ```
> > 
> > Does it matter?!
> Yes, it does matter.  The cwd you reference will no longer exist when
> the bindings are installed.  The purpose of generating the file is to
> fill it with useful, persisting data,

Oh, I thought it was only used at build time! Sorry, my mistake!


> 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" "'"
```


> As for the version file, that should probably be
> set to an error value such as None or NotImplemented or even unset.  It
> does not appear to be currently used and we don't install any such file
> for notmuch.

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?!

Thanks again for your precious help!

-- 
Tanguy




^ permalink raw reply	[flat|nested] 17+ messages in thread

* [bug#54396] [PATCH v2] [WIP] gnu: python-notmuch2: Fix build.
  2022-03-16 13:46     ` Tanguy LE CARROUR
@ 2022-03-16 14:02       ` Liliana Marie Prikler
  2022-03-16 16:48         ` Tanguy LE CARROUR
  0 siblings, 1 reply; 17+ messages in thread
From: Liliana Marie Prikler @ 2022-03-16 14:02 UTC (permalink / raw)
  To: Tanguy LE CARROUR; +Cc: 54396

Hi,

Am Mittwoch, dem 16.03.2022 um 14:46 +0100 schrieb Tanguy LE CARROUR:
> Hi Liliana,
> [...]
> 
> > 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.

> > As for the version file, that should probably be set to an error
> > value such as None or NotImplemented or even unset.  It does not
> > appear to be currently used and we don't install any such file
> > for notmuch.
> 
> 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.

Cheers




^ permalink raw reply	[flat|nested] 17+ messages in thread

* [bug#54396] [PATCH v2] [WIP] gnu: python-notmuch2: Fix build.
  2022-03-16 14:02       ` Liliana Marie Prikler
@ 2022-03-16 16:48         ` Tanguy LE CARROUR
  2022-03-17  6:59           ` Liliana Marie Prikler
  0 siblings, 1 reply; 17+ messages in thread
From: Tanguy LE CARROUR @ 2022-03-16 16:48 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 54396

[-- 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


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [bug#54396] [PATCH v2] [WIP] gnu: python-notmuch2: Fix build.
  2022-03-16 16:48         ` Tanguy LE CARROUR
@ 2022-03-17  6:59           ` Liliana Marie Prikler
  2022-03-17  9:43             ` Tanguy LE CARROUR
  0 siblings, 1 reply; 17+ messages in thread
From: Liliana Marie Prikler @ 2022-03-17  6:59 UTC (permalink / raw)
  To: Tanguy LE CARROUR; +Cc: 54396

Hi Tanguy,

Am Mittwoch, dem 16.03.2022 um 17:48 +0100 schrieb Tanguy LE CARROUR:
> > 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.
I think you misunderstood me.  It is absolutely necessary that you
instantiate these variables correctly.  It is not necessary to
substitute* their uses.

> > > 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.
substitute* is not nice when dealing with multi-line expressions.  I
think you could replace NOTMUCH_VERSION_FILE with '/dev/null' and
"VERSION = .*" with (string-append "VERSION = " #$version).

Cheers




^ permalink raw reply	[flat|nested] 17+ messages in thread

* [bug#54396] [PATCH v2] [WIP] gnu: python-notmuch2: Fix build.
  2022-03-17  6:59           ` Liliana Marie Prikler
@ 2022-03-17  9:43             ` Tanguy LE CARROUR
  2022-03-17  9:51               ` Liliana Marie Prikler
  0 siblings, 1 reply; 17+ messages in thread
From: Tanguy LE CARROUR @ 2022-03-17  9:43 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 54396

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

Hi Liliana,


Quoting Liliana Marie Prikler (2022-03-17 07:59:48)
> Am Mittwoch, dem 16.03.2022 um 17:48 +0100 schrieb Tanguy LE CARROUR:
> > > 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.
> I think you misunderstood me.  It is absolutely necessary that you
> instantiate these variables correctly.  It is not necessary to
> substitute* their uses.

You right, I **totally** misunderstood you! Sorry!
I didn't pay attention to the fact that I left the actual file names in,
instead of using the folder names.
Hope I've gotten it right this time and that you are not getting tired
of reviewing my patch! :-)


> > > > 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.
> substitute* is not nice when dealing with multi-line expressions.  I
> think you could replace NOTMUCH_VERSION_FILE with '/dev/null' and
> "VERSION = .*" with (string-append "VERSION = " #$version).

Oh, looks like gexp magic to me, right? I'm not (yet) comfortable with it!
So I came up with another version. Seems to work as I've built,
installed and used it!

I'm attaching v5. Finger crossed! :-)

Thanks again for you time!

-- 
Tanguy

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

From ecdb6dab3901e661544f4cd8aaf892f939b5e4ee 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 v5] 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..2b44f84446 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_VERSION_FILE='/dev/null'\n"
+                   "NOTMUCH_INCLUDE_DIR="
+                   "'" (assoc-ref inputs "notmuch") "/include/" "'\n"
+                   "NOTMUCH_LIB_DIR="
+                   "'" (assoc-ref inputs "notmuch") "/lib/" "'"))))))
+         ;; 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"
+               (("version=VERSION,")
+                (string-append "version='" ,(package-version this-package) "',"))))))))
     (synopsis "Pythonic bindings for the notmuch mail database using CFFI")
     (license license:gpl3+)))
 
-- 
2.34.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [bug#54396] [PATCH v2] [WIP] gnu: python-notmuch2: Fix build.
  2022-03-17  9:43             ` Tanguy LE CARROUR
@ 2022-03-17  9:51               ` Liliana Marie Prikler
  2022-03-17 17:32                 ` Tanguy LE CARROUR
  0 siblings, 1 reply; 17+ messages in thread
From: Liliana Marie Prikler @ 2022-03-17  9:51 UTC (permalink / raw)
  To: Tanguy LE CARROUR; +Cc: 54396

Am Donnerstag, dem 17.03.2022 um 10:43 +0100 schrieb Tanguy LE CARROUR:
> Hi Liliana,
> 
> Quoting Liliana Marie Prikler (2022-03-17 07:59:48)
> > Am Mittwoch, dem 16.03.2022 um 17:48 +0100 schrieb Tanguy LE
> > CARROUR:
> > > > 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.
> > I think you misunderstood me.  It is absolutely necessary that you
> > instantiate these variables correctly.  It is not necessary to
> > substitute* their uses.
> 
> You right, I **totally** misunderstood you! Sorry!
> I didn't pay attention to the fact that I left the actual file names
> in, instead of using the folder names.
> Hope I've gotten it right this time and that you are not getting
> tired of reviewing my patch! :-)
You'd do well using search-input-file as I've suggested for a while now
;)
> > > 
> > > > 

> > substitute* is not nice when dealing with multi-line expressions. 
> > I think you could replace NOTMUCH_VERSION_FILE with '/dev/null' and
> > "VERSION = .*" with (string-append "VERSION = " #$version).
> 
> Oh, looks like gexp magic to me, right? I'm not (yet) comfortable
> with it!  So I came up with another version. Seems to work as I've
> built, installed and used it!
I think we need to convert this package to the newstyle anyway, so it's
not something you have to do, but it'd be appreciated if you first
translated the existing package to use gexps and then applied your
modifications on top.  That being said, using this-package is IIRC fine
for such purposes.

Regarding NOTMUCH_VERSION_FILE, I don't think we should put an
"implemented" value into a file that (as far as I can see) ends up
being installed.  So here you have to substitute* the use in setup.py
instead.

Cheers




^ permalink raw reply	[flat|nested] 17+ messages in thread

* [bug#54396] [PATCH v2] [WIP] gnu: python-notmuch2: Fix build.
  2022-03-17  9:51               ` Liliana Marie Prikler
@ 2022-03-17 17:32                 ` Tanguy LE CARROUR
  0 siblings, 0 replies; 17+ messages in thread
From: Tanguy LE CARROUR @ 2022-03-17 17:32 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 54396

Hi Liliana,


Quoting Liliana Marie Prikler (2022-03-17 10:51:41)
> Am Donnerstag, dem 17.03.2022 um 10:43 +0100 schrieb Tanguy LE CARROUR:
> > Quoting Liliana Marie Prikler (2022-03-17 07:59:48)
> > > Am Mittwoch, dem 16.03.2022 um 17:48 +0100 schrieb Tanguy LE
> > > CARROUR:
> > > > > 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.
> > > I think you misunderstood me.  It is absolutely necessary that you
> > > instantiate these variables correctly.  It is not necessary to
> > > substitute* their uses.
> > 
> > You right, I **totally** misunderstood you! Sorry!
> > I didn't pay attention to the fact that I left the actual file names
> > in, instead of using the folder names.
> > Hope I've gotten it right this time and that you are not getting
> > tired of reviewing my patch! :-)
> You'd do well using search-input-file as I've suggested for a while now
> ;)

You're right! So, now, it looks like:

```
(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")) "'"))))))
```


> > > substitute* is not nice when dealing with multi-line expressions. 
> > > I think you could replace NOTMUCH_VERSION_FILE with '/dev/null' and
> > > "VERSION = .*" with (string-append "VERSION = " #$version).
> > 
> > Oh, looks like gexp magic to me, right? I'm not (yet) comfortable
> > with it!  So I came up with another version. Seems to work as I've
> > built, installed and used it!
> I think we need to convert this package to the newstyle anyway,
> not something you have to do, but it'd be appreciated if you first
> translated the existing package to use gexps and then applied your
> modifications on top.  That being said, using this-package is IIRC fine
> for such purposes.

OK, I'll try to do that. But, in order not to spam you with stupid code and
questions, I'll think about it for few days and probably do it at the
week end.


> Regarding NOTMUCH_VERSION_FILE, I don't think we should put an
> "implemented" value into a file that (as far as I can see) ends up
> being installed.  So here you have to substitute* the use in setup.py
> instead.

It now looks like this:

```
 (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) "',")))))
```

I'll submit a new patch later this week with the gexp version!… if I
manage to write it! ^_^'

Thanks again for your valuable advice and time!

-- 
Tanguy




^ permalink raw reply	[flat|nested] 17+ messages in thread

* [bug#54396] [PATCH v6] gnu: python-notmuch2: Fix build.
  2022-03-15  9:38 [bug#54396] [PATCH] [WIP] gnu: python-notmuch2: Fix build Tanguy Le Carrour
                   ` (2 preceding siblings ...)
  2022-03-16 11:16 ` [bug#54396] [PATCH v2] " Tanguy Le Carrour
@ 2022-03-22 16:11 ` Tanguy Le Carrour
  2022-03-23 20:15   ` bug#54396: " Liliana Marie Prikler
  3 siblings, 1 reply; 17+ messages in thread
From: Tanguy Le Carrour @ 2022-03-22 16:11 UTC (permalink / raw)
  To: liliana.prikler, 54396; +Cc: 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,

-- 
Tanguy

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

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+)))
 
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 17+ messages in thread

* bug#54396: [PATCH v6] gnu: python-notmuch2: Fix build.
  2022-03-22 16:11 ` [bug#54396] [PATCH v6] " Tanguy Le Carrour
@ 2022-03-23 20:15   ` Liliana Marie Prikler
  2022-03-24  7:11     ` [bug#54396] " Tanguy LE CARROUR
  0 siblings, 1 reply; 17+ messages in thread
From: Liliana Marie Prikler @ 2022-03-23 20:15 UTC (permalink / raw)
  To: Tanguy Le Carrour, 54396-done

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




^ permalink raw reply	[flat|nested] 17+ messages in thread

* [bug#54396] [PATCH v6] gnu: python-notmuch2: Fix build.
  2022-03-23 20:15   ` bug#54396: " Liliana Marie Prikler
@ 2022-03-24  7:11     ` Tanguy LE CARROUR
  0 siblings, 0 replies; 17+ messages in thread
From: Tanguy LE CARROUR @ 2022-03-24  7:11 UTC (permalink / raw)
  To: 54396-done, Liliana Marie Prikler

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,

-- 
Tanguy




^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-03-24  7:12 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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.