- Notifications
You must be signed in to change notification settings - Fork 70
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
jelly commented Oct 3, 2025
This needs some discussion, do you want a custom target or always build documentation when |
jelly commented Oct 3, 2025
Also FYI, |
meson.build Outdated
| 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=trueoption (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.
keszybz commented Oct 12, 2025 via email
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. |
jelly commented Oct 13, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
We tried copying over the |
keszybz commented Oct 16, 2025
Please rebase on top of #161 which was just merged. |
0ccfc5c to 87d97adComparejelly commented Oct 17, 2025
I wonder if I should remove the Another thing I wonder about if you want me to move this to |
keszybz commented Oct 21, 2025
I think this doesn't matter. Packaging can just list the docs separately.
I think it's fine right now. It's just a few lines anyway… I get the following: |
Introduce a custom target `html` and a build configuration option `docs` to build the sphinx html documentation.
87d97ad to f5a0dd8Compare
keszybz left a comment
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.
LGTM, thanks.
cb50f8b into systemd:mainUh oh!
There was an error while loading. Please reload this page.
Introduce a custom target
build-docsto build the sphinx documentation.