Systemd has had a single -dev binary package since ~2014, so these have
not worked for a long time.
Noted in #138 (but not the main thrust of the issue)
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.
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.
[5/10] Compiling C object src/systemd/login.cpython-313-x86_64-linux-gnu.so.p/login.c.o
../src/systemd/login.c:321:1: warning: missing initializer for field ‘m_slots’ of ‘struct PyModuleDef’ [-Wmissing-field-initializers]
321 | };
| ^
In file included from /usr/include/python3.13/Python.h:95,
from ../src/systemd/login.c:6:
/usr/include/python3.13/moduleobject.h:113:21: note: ‘m_slots’ declared here
113 | PyModuleDef_Slot *m_slots;
| ^~~~~~~
Drop specification of kwargs in the _reader.Journal.add_match registration. The
handling was never implemented, so any any kwargs would be summarilly ignored.
The handling of kwargs is done in the python wrapper, so no kwargs are passed
to the native C function (and would be ignored if they were). IIRC, the plan
was initially to do this in the C extension, but then we realized that this is
very much not a hot path and doing in the the wrapper is just fine.
_unused_ is used for 'self' wherever the function does not use self.
assert(!args) is added in the places where METH_NOARGS is used.
assert(self) is added in a few places where self _is_ used.
$ 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.
With the switch to meson-python, meson makes the dist which includes
everything required already by default. (meson-python also does not
support a MANIFEST file)
The config is copied from systemd. The existing config specified 4-space
indent for C, but individual files override this and the files in fact use
8 spaces.
The config for Python doesn't seem necessary anymore either. I think utf-8
is used everywhere by default.
Newer sphinx doesn't like the old syntax:
Running Sphinx v8.1.3
loading translations [en]... done
making output directory... done
Converting `source_suffix = '.rst'` to `source_suffix = {'.rst': 'restructuredtext'}`.
ERROR: Invalid value `None` in intersphinx_mapping['http://docs.python.org/']. Expected a two-element tuple or list.