unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [WIP PATCH 0/1] autodoc failed to import notmuch2
@ 2021-10-21  9:51 Michael J Gruber
  2021-10-21  9:51 ` [WIP PATCH 1/1] autodoc: fix search path for notmuch2 module Michael J Gruber
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Michael J Gruber @ 2021-10-21  9:51 UTC (permalink / raw)
  To: notmuch

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

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

end of thread, other threads:[~2021-12-04 13:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21  9:51 [WIP PATCH 0/1] autodoc failed to import notmuch2 Michael J Gruber
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

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).