From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 4JJwMHE5cWG7dQEAgWs5BA (envelope-from ) for ; Thu, 21 Oct 2021 11:57:05 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id sO0SLHE5cWHXBQAA1q6Kng (envelope-from ) for ; Thu, 21 Oct 2021 09:57:05 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 45E1432AD9 for ; Thu, 21 Oct 2021 11:57:05 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 87E6F26F02; Thu, 21 Oct 2021 05:57:02 -0400 (EDT) X-Greylist: delayed 334 seconds by postgrey-1.36 at nmbug; Thu, 21 Oct 2021 05:57:00 EDT Received: from mailproxy07.manitu.net (mailproxy07.manitu.net [IPv6:2a00:1828:1000:1112::2]) by mail.notmuchmail.org (Postfix) with ESMTPS id 07B9626EFB for ; Thu, 21 Oct 2021 05:57:00 -0400 (EDT) Received: from localhost (200116b8606430004cd9f5d7a042c115.dip.versatel-1u1.de [IPv6:2001:16b8:6064:3000:4cd9:f5d7:a042:c115]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: michael@grubix.eu) by mailproxy07.manitu.net (Postfix) with ESMTPSA id D68B0C883A; Thu, 21 Oct 2021 11:51:24 +0200 (CEST) From: Michael J Gruber To: notmuch@notmuchmail.org Subject: [WIP PATCH 0/1] autodoc failed to import notmuch2 Date: Thu, 21 Oct 2021 11:51:21 +0200 Message-Id: X-Mailer: git-send-email 2.33.0.1146.g7ac282475c MIME-Version: 1.0 Message-ID-Hash: QHAB5Q4KQGQULAFETZL5C3DG4MIVTI5Z X-Message-ID-Hash: QHAB5Q4KQGQULAFETZL5C3DG4MIVTI5Z X-MailFrom: git@grubix.eu X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1634810225; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Ytf6zeOUFrMew2stK1G/cZjxIe399fEtERtvgjeOgBk=; b=YilKK+qWk5CTalDo4/yaEx+5trFwYF480gJKsdsMQ3rhr6zxvbFAo84myZuIL0JFaZ748G 9963XD+ec2zheI+9JzCDZorzAK4NA3k2/Ro8m79ss5EVomo/UWS9mGru1/Ge3Qa1kNkje6 qbBD7n0TLFVww8FqwOGQUmZuE8oyp6ZCOFSVvHAoXuXSZb8m97jVLhdMPuGYFTdabW2MG5 RocN7uPqfTQW/uQ1sP7jFC4550c5ubmboO5iqBUTBpWRqNEVgwkuSW2wKgGfqYSSu8Z4Va DiA1uYftVFgzwQQ/xDjyoqip8oVIA1sACtwvzt/UzfwT3tLS2mJAti0V/Xk5ZQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1634810225; a=rsa-sha256; cv=none; b=pgU+tmyBvOKpa+9PyKQLx89PrtcfEwkiGOeKi8X4hZuJk/JFLInkNl4n7o3TXgm8YmtobV wiRO56od5Mov2BLNEdtekeGQ857Dupip4TPl01HcqXrVBjciTcQZG8Syl4Tj38tBgNuKNb cCaBFfw9ItgUfDrh62Q8MEOkSHDJS3W24pvJ5ZbzzZJlEg+esk055JGm6IHOF1WJhJUKvJ muFeB/CvHVfcSjeEvA44soYPljDCZwmh+Gc05Gv6l9xbXRfqQpNHRhJMAKoudDOvSs943j c+4YTafxZU3Z2IvTTjHR8rzmQ36pbCxhML/cjzpr2E0O7KrsjxsnB+BH2aTbXA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.16 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 45E1432AD9 X-Spam-Score: -1.16 X-Migadu-Scanner: scn0.migadu.com X-TUID: e/s1RUs0VDXU Hi there During Fedora package builds I noticed that autodoc fails to import the notmuch2 module: ``` WARNING: autodoc: failed to import module 'notmuch2'; the following exception was raised: No module named 'notmuch2' ``` You never notice this on your own box where notmuch2 is installed, because then the build finds the previously installed module. But this is wrong, of course, because autodoc is supposed to document tthe module being build (in-source module). There are actually several problems leading to this: 1. search path The module residing in `bindings/python-cffi/notmuch2/__init__.py` needs a search path `bindings/python-cffi/`, not `bindings/python-cffi/notmuch2`. If we fix just that we get: ``` WARNING: autodoc: failed to import module 'notmuch2'; the following exception was raised: cannot import name '_capi' from partially initialized module 'notmuch2' (most likely due to a circular import) (/builddir/build/BUILD/notmuch-0.34/doc/../bindings/python-cffi/notmuch2/__init__.py) ``` 2. search path, again The module is built in `bindings/python-cffi/build/stage`, that is where `_capi` is to be found, and PATCH 1/1 fixes the path in `doc/conf.py`. 3. build order The patch from 2. actually helps only if we build in the following order (make targets): notmuch notmuch-shared ruby-bindings python-cffi-bindings all In particular, the bindings need to be built before the docs I can do this using two make calls, but a proper solution would specify the dependencies in the makefile. 4. library search path When you do 1. through 3. then autodoc almost manages to import notmuch2: it finds the proper module, _capi is found, but then libnotmuch.so is not found because LD_LIBRARY_PATH would need to be amended to find the freshly build library. Now, maybe I should simply ignore the autodoc warning. Or I should change my packaging to build twice (make && make install && make clean && make && make install). At least I wanted to raise attention to this. This problem (if it is one) is not specific to 0.34, it was the same at least with 0.33 but - being just a warning - was unnoticed. Cheers Michael Michael J Gruber (1): autodoc: fix search path for notmuch2 module doc/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.33.0.1146.g7ac282475c