-
Notifications
You must be signed in to change notification settings - Fork 69
meson: build docs with meson #158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Introduce a custom target `build-docs` to build the sphinx documentation.
This needs some discussion, do you want a custom target or always build documentation when |
Also FYI,
|
custom_target('build-docs', | ||
output: 'index.html', | ||
input: files('docs/conf.py'), | ||
command: [sphinx_build, '-b', 'html', sphinx_args, input_dir, output_dir], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make it so that it is built by default and installed if docs
is true? It's nice if the target is always defined, because then it makes development easier, because one can rebuild the docs on demand but it doesn't interfere with normal development.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, and let's call the target docs
…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, so this was mostly me learning a bit more of meson and I was leaning on two ideas:
- For packaging you probably want a
-Ddocs=true
option (so this also needs an install target) - For development you could get away with just
meson -C build build-docs
I'm happy to make this a docs
target and default to true, probably should also add an install target then.
However the main blocker for this is building the docs that they need to import systemd
and that can't be done from a checkout even with setting PYTHONPATH=build/src
. @behrmann was working on moving the tests to a meson
target with a virtualenv and an editable install so that would need to be finished first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
→ #161
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
→ #161
Hah! Was hacking towards the same objective yesterday night and that led to the same success with PYTHONPATH=build/src pytest test
. So not having to copy the tests around.
On Sun, Oct 12, 2025 at 05:41:14AM -0700, Jelle van der Waa wrote:
I'm happy to make this a `docs` target and default to true, probably should also add an install target then.
Meson has 'install tags'. We could add that, but I think that might be
overkill.
I think there are two main scenarios:
- to build docs for development or local use: for that, 'ninja -C build docs'
is the answer.
- to build docs as part of a package build and installation. For that, setting
a config option and then just having everything happen as part of the main
build and install works best.
However the main blocker for this is building the docs that they need to import `systemd` and that can't be done from a checkout even with setting `PYTHONPATH=build/src`. @behrmann was working on moving the tests to a `meson` target with a virtualenv and an editable install so that would need to be finished first.
Yeah, the current state is fairly annoying. I think it'd be nice to
just copy the .py files to the build directory and import the module
from there. Maybe some sort of enhancement to meson-python would be
possible.
|
We tried copying over the |
Please rebase on top of #161 which was just merged. |
Introduce a custom target
build-docs
to build the sphinx documentation.