From patchwork Wed Mar 16 16:48:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tanguy LE CARROUR X-Patchwork-Id: 37891 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id DBE5727BBEA; Wed, 16 Mar 2022 16:57:51 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 7540827BBE9 for ; Wed, 16 Mar 2022 16:57:51 +0000 (GMT) Received: from localhost ([::1]:55696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nUWy6-0007fC-JH for patchwork@mira.cbaines.net; Wed, 16 Mar 2022 12:57:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40286) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nUWpa-0004U1-7v for guix-patches@gnu.org; Wed, 16 Mar 2022 12:49:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58278) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nUWpZ-0006Vp-SL for guix-patches@gnu.org; Wed, 16 Mar 2022 12:49:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nUWpZ-0004Rk-Oj for guix-patches@gnu.org; Wed, 16 Mar 2022 12:49:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54396] [PATCH v2] [WIP] gnu: python-notmuch2: Fix build. Resent-From: Tanguy LE CARROUR Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 16 Mar 2022 16:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54396 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Liliana Marie Prikler Cc: 54396@debbugs.gnu.org Received: via spool by 54396-submit@debbugs.gnu.org id=B54396.164744932817071 (code B ref 54396); Wed, 16 Mar 2022 16:49:01 +0000 Received: (at 54396) by debbugs.gnu.org; 16 Mar 2022 16:48:48 +0000 Received: from localhost ([127.0.0.1]:52175 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nUWpG-0004R6-CZ for submit@debbugs.gnu.org; Wed, 16 Mar 2022 12:48:48 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:40651) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nUWpD-0004Qr-OD for 54396@debbugs.gnu.org; Wed, 16 Mar 2022 12:48:41 -0400 Received: (Authenticated sender: tanguy@bioneland.org) by mail.gandi.net (Postfix) with ESMTPSA id C4759200010; Wed, 16 Mar 2022 16:48:31 +0000 (UTC) MIME-Version: 1.0 References: <20220316111624.26189-1-tanguy@bioneland.org> <6b3d3874c3953688431be77f08989ef709780443.camel@ist.tugraz.at> <164743841502.31835.14352244026552742248@localhost> From: Tanguy LE CARROUR In-Reply-To: Date: Wed, 16 Mar 2022 17:48:31 +0100 Message-ID: <164744931122.17491.16594765317356733408@localhost> User-Agent: alot/0.10 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches 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, From 590bfced58815504ed7ed71f8832107b6e0980c0 Mon Sep 17 00:00:00 2001 From: Tanguy Le Carrour 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 ;;; Copyright © 2018 Gábor Boskovits ;;; Copyright © 2018, 2019, 2020, 2021, 2022 Ricardo Wurmus -;;; Copyright © 2019, 2020, 2021 Tanguy Le Carrour +;;; Copyright © 2019, 2020-2022 Tanguy Le Carrour ;;; Copyright © 2020 Vincent Legoll ;;; Copyright © 2020 Justus Winter ;;; Copyright © 2020 Eric Brown @@ -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