From: Michael J Gruber <git@grubix.eu>
To: notmuch@notmuchmail.org
Subject: [WIP PATCH 0/1] autodoc failed to import notmuch2
Date: Thu, 21 Oct 2021 11:51:21 +0200 [thread overview]
Message-ID: <cover.1634808719.git.git@grubix.eu> (raw)
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
next reply other threads:[~2021-10-21 9:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-21 9:51 Michael J Gruber [this message]
2021-10-21 9:51 ` [WIP PATCH 1/1] autodoc: fix search path for notmuch2 module Michael J Gruber
2021-10-21 12:20 ` [WIP PATCH 0/1] autodoc failed to import notmuch2 David Bremner
2021-10-21 12:36 ` Michael J Gruber
2021-10-21 13:02 ` David Bremner
2021-10-29 14:54 ` [PATCH] doc/python-cffi: import from built bindings, not installed module David Bremner
2021-12-04 13:48 ` David Bremner
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
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1634808719.git.git@grubix.eu \
--to=git@grubix.eu \
--cc=notmuch@notmuchmail.org \
/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 public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).