Commit graph

11 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
5f9508755a meson: silence warning about unused parameters
It seems some gcc versions enable it by default, so we get a lot
of warnings.
2026-06-18 15:04:20 +02:00
Jelle van der Waa
cb50f8b057 meson: build docs with meson
Introduce a custom target `html` and a build configuration option
`docs` to build the sphinx html documentation.
2025-11-03 09:49:35 +01:00
Zbigniew Jędrzejewski-Szmek
f65499816c meson: add test to run pytest
The python binary that was initially found is used to launch pytest.

It turns out to be surprisingly hard to run 'pytest' in test() with the python
binary detected using meson's python module. test() does not allow the
"program" argument to be a str, which is what python module's .full_path()
returns. So let's "find" the program again. This results in one line of noise
in meson output, but I don't see a nicer way.

'ninja -C build test' works. 'meson test -C build' is better, because it can be
called with '-v' to print details of the test.
2025-10-15 18:03:56 +02:00
Zbigniew Jędrzejewski-Szmek
17016e1a76 meson: copy .py files to build directory
This seems to do the trick:
$ ninja -C build
$ PYTHONPATH=build/src/ python -c 'from systemd import id128; print(id128)'
<module 'systemd.id128' from '/home/zbyszek/src/python-systemd/build/src/systemd/id128.cpython-313-x86_64-linux-gnu.so'>
$ PYTHONPATH=build/src/ pytest src/systemd/test
...
============================ test session starts =============================
platform linux -- Python 3.13.4, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/zbyszek/src/python-systemd
configfile: pyproject.toml
plugins: ...
collected 61 items

build/src/systemd/test/test_daemon.py ........................         [ 39%]
build/src/systemd/test/test_id128.py ....                              [ 45%]
build/src/systemd/test/test_journal.py ............................    [ 91%]
build/src/systemd/test/test_login.py .....                             [100%]

============================= 61 passed in 0.21s =============================
2025-10-15 18:03:31 +02:00
Zbigniew Jędrzejewski-Szmek
1afbdabfb9
Merge pull request #160 from keszybz/modernize-code-and-silence-all-warnings
Modernize code and silence all warnings
2025-10-15 09:59:26 +02:00
Zbigniew Jędrzejewski-Szmek
163a99aa25 modules: include Python.h from one place only, clean up includes
systemd headers should be included using <>.
And use a single include of Python.h and define PY_SSIZE_T_CLEAN
before it, so that we're using a consistent API everywhere.
2025-10-15 09:50:59 +02:00
Zbigniew Jędrzejewski-Szmek
5906f045a4 meson: add global defines using add_project_arguments()
We're not going to be compiling any other C code, so let's simplify
this.
2025-10-15 09:50:59 +02:00
Zbigniew Jędrzejewski-Szmek
7704ae04c6 meson: hook up update-constants helper
$ ninja -C build update-constants -v
ninja: Entering directory `build'
[1/1] /home/zbyszek/src/python-systemd/update-constants.py /home/zbyszek/src/python-systemd/src/systemd/id128-constants.h /home/zbyszek/src/python-systemd/docs/id128.rst /home/zbyszek/src/python-systemd/src/systemd/id128-defines.h /usr/include/systemd/sd-messages.h
Writing /home/zbyszek/src/python-systemd/src/systemd/id128-constants.h…
Writing /home/zbyszek/src/python-systemd/src/systemd/id128-defines.h…
Writing /home/zbyszek/src/python-systemd/docs/id128.rst…

The helper is updated to do the everything in the python script. The wrapper in
Makefile is dropped. It wasn't working properly anyway, and I think the version
in meson is enough.
2025-10-11 22:26:41 +02:00
Zbigniew Jędrzejewski-Szmek
0677c4a2a5 Use SPDX license tags instead of old-style license headers
This matches the change that was done in the systemd repo
a few years ago.
2025-10-03 16:32:42 +02:00
Zbigniew Jędrzejewski-Szmek
eba21faa3b meson: remove unnecessary meson.build file 2025-10-03 14:36:25 +02:00
Nguyễn Hồng Quân
31b17c0b29 Adopt pyproject.toml and Meson to build Python extension 2025-06-30 18:58:20 +07:00