Commit Graph

59 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
b04c8c83e8 systemd-python: add systemd.daemon wrapping sd-daemon
Please see the documentation (e.g. pydoc3 systemd.daemon) for full
description. As usual, systemd._daemon wraps the raw interface, while
systemd.daemon provides the more pythonic API. sd_listen_fds,
sd_booted, sd_is_fifo, sd_is_socket, sd_is_socket_unix,
sd_is_socket_inet, sd_is_mq, and SD_LISTEN_FDS_START are currently
wrapped.
2013-03-15 22:55:24 -04:00
Zbigniew Jędrzejewski-Szmek
702f64b93c man,html: say 'systemd 198' in the header
This should help readers of the man or HTML pages know if the documentation
is out of date. An alternative to use a date generated from 'git log' was
considered, but since we try to keep user visible documentation up to date,
showing the project version should be enough.
2013-03-12 23:57:46 -04:00
Zbigniew Jędrzejewski-Szmek
082cca735b python/docs: use the same links on top as in man pages
I forgot to commit the layout file, because it was gitignored.
Fixed now.
2013-03-09 09:56:19 -05:00
Zbigniew Jędrzejewski-Szmek
fa28d83678 html: make python docs look more like the rest
The result is ugly enough, I hope, to motivate someone with
design skills to fix it.
2013-03-09 08:47:50 -05:00
Zbigniew Jędrzejewski-Szmek
9f06e912f6 systemd-python: provide version info to sphinx 2013-03-09 08:47:50 -05:00
Zbigniew Jędrzejewski-Szmek
db7f1dde30 systemd-python: fix segfault on double close 2013-03-07 15:35:50 -05:00
Zbigniew Jędrzejewski-Szmek
516424a411 systemd-python: fix typos 2013-03-07 15:35:50 -05:00
Zbigniew Jędrzejewski-Szmek
614e5fbb8b systemd-python: update documentation for new systemd-journal group 2013-03-07 11:29:08 -05:00
Zbigniew Jędrzejewski-Szmek
0eff0f3bce systemd-python: refuse path and flags together in __init__
It's better to explictly check, instead of just documenting it.

The return value from init is changed from 1 to -1 on error.
Python seems to ignore 1 every second time. Looks like a bug
in Python, but the return value doesn't seem to be documented
anywhere, and -1 works as expected... so let's just use that.
2013-03-07 11:29:08 -05:00
Zbigniew Jędrzejewski-Szmek
f2e82cd5ad systemd-python: export sd_j_get_fd, sd_j_reliable_fd, sd_j_close
sd_journal_get_fd(j) is called j.fileno(), for compatiblity with
Python conventions for file-like objects.

More importantly, those new .seek_head() and .seek_tail() do not
call .get_next(). This is better, if one wants to skip before
retrieving an entry.
2013-03-07 00:45:56 -05:00
Zbigniew Jędrzejewski-Szmek
5c1c14b3a0 systemd-python: split .seek() into .seek_head() and .seek_tail()
This way python code follows the original interface more closely.
Also, .seek(0, journal.SEEK_END) was just to much to type.
2013-03-07 00:45:56 -05:00
Zbigniew Jędrzejewski-Szmek
aaf0806118 systemd-python: catch only ValueErrors in conversion code
First of all, 'try: ... except: ...' (with no exception specified) is
always a no-no, since it catches all BaseExceptions, which includes ^C
and other stuff which should almost never be caught.

Now the conversion is stricter, and only one conversion is attempted,
and only a ValueEror is caught. It seems reasonable to catch ValueErrors,
since the entries in the journal are not verified, and any erroneous
application might log a field which cannot be converted. The consumer
of events must only check if a field is an instance of bytes and can
otherwise assume that the conversion was performed correctly.

Order of arguments in Reader.__init__ has been changed to match order
in _Reader.__init__.

Conversions have been updated to work under Python 2 and 3.
2013-03-07 00:45:56 -05:00
Zbigniew Jędrzejewski-Szmek
6210afbcff systemd-python: fix error check in _Reader.wait() 2013-03-05 23:23:09 -05:00
Lukas Nykryn
684ecf306a systemd-python: add missing check for return of PyDict_SetItem in _reader.c 2013-03-01 16:43:57 -05:00
Zbigniew Jędrzejewski-Szmek
7f41820b07 python-systemd: rename Journal to Reader
It seems inevitable that we'll also grow a writing interface,
and then it'll be cumbersome to have a "Journal" for reading,
and a "Writer" for writing.
2013-02-28 20:04:17 -05:00
Zbigniew Jędrzejewski-Szmek
86e3d32a1d systemd-python: return both parts of sd_journal_get_monotonic_usec
In Python 3, a named tuple is used. In Python 2, a simple
tuple is used. In either case, the pair is (timestamp, bootid).
2013-02-28 20:04:17 -05:00
Zbigniew Jędrzejewski-Szmek
6a6633a16a python-systemd: check all errors and use automatic cleanup
__REALTIME_TIMESTAMP and __MONOTONIC_TIMESTAMP return ints.
It doesn't make sense to convert to string, just to convert
back to a number later on.

Also try to follow systemd rules for indentation.
2013-02-28 20:04:17 -05:00
Zbigniew Jędrzejewski-Szmek
5c083fa815 systemd-python: hide ChainMap import 2013-02-28 20:04:17 -05:00
Zbigniew Jędrzejewski-Szmek
df2795d9f9 systemd-python: document attributes
In id128 it would be better to add everything automatically, but
sphinx cannot do this right now.
2013-02-28 20:04:17 -05:00
Zbigniew Jędrzejewski-Szmek
a244c095c2 systemd-python: use PyModule_AddObject in id128 2013-02-28 20:04:17 -05:00
Zbigniew Jędrzejewski-Szmek
2c07646764 systemd-python: polish the docstrings 2013-02-28 19:36:14 -05:00
Zbigniew Jędrzejewski-Szmek
33ed3769b5 systemd-python: indenation and style tweaks 2013-02-22 18:09:49 +01:00
Zbigniew Jędrzejewski-Szmek
0d92ee93dc systemd-python: downgrade _reader.c to C89 2013-02-22 16:57:45 +01:00
Zbigniew Jędrzejewski-Szmek
118bf4bad8 systemd-python: add casts and fix unused variable warnings in _reader 2013-02-22 16:57:45 +01:00
Zbigniew Jędrzejewski-Szmek
ecb6dfe117 systemd-python: wrap some python differences using macros 2013-02-22 16:57:45 +01:00
Zbigniew Jędrzejewski-Szmek
e82e4f4562 systemd-python: introduce error setting helper 2013-02-22 16:57:45 +01:00
Steven Hiscocks
cac40fbe24 systemd-python: Added doc string for Journal 2013-02-22 16:57:45 +01:00
Steven Hiscocks
eccc9e74d2 systemd-python: Journal convert_unicode exception handling change
Rather than catch all, is now limited to UnicodeDecodeError
2013-02-22 16:57:44 +01:00
Steven Hiscocks
89d9a23389 systemd-python: add Journal method to add MESSAGE_ID match 2013-02-22 16:57:44 +01:00
Steven Hiscocks
6d0c634ca3 systemd-python: fix memory leak in _reader and minor bugs
iternext now checks for error from get_next, and changed a DECREF to
XDECREF rather than NULL check
2013-02-22 16:57:44 +01:00
Steven Hiscocks
c71f26eba5 systemd-python: update Journal python docstrings 2013-02-22 16:57:44 +01:00
Steven Hiscocks
b835982344 systemd-python: tidy up import names in journal 2013-02-22 16:57:44 +01:00
Steven Hiscocks
301ae164b7 systemd-python: Journal this_boot/machine now accepts ID 2013-02-22 16:57:44 +01:00
Steven Hiscocks
dd37d563ba systemd-python: remove unneeded ifdef for query_unique 2013-02-22 16:57:44 +01:00
Steven Hiscocks
518dc5dff5 systemd-python: _reader now takes unix timestamp in seconds 2013-02-22 16:57:44 +01:00
Steven Hiscocks
83718af6f5 systemd-python: Update _reader docstrings 2013-02-22 16:57:44 +01:00
Steven Hiscocks
5bb2b8d5e4 systemd-python: _reader add_match takes single string
python code now takes care of multiple matches
2013-02-22 16:57:44 +01:00
Steven Hiscocks
a49f4d17bf systemd-python: correct data_threshold error return value 2013-02-22 16:57:44 +01:00
Steven Hiscocks
d2dd0265b5 systemd-python: updated _reader header to standard license 2013-02-22 16:57:44 +01:00
Steven Hiscocks
7a1b9cd5e4 systemd-python: Moved _reader datetime usage to python 2013-02-22 16:57:44 +01:00
Steven Hiscocks
71766afa2d systemd-python: Tidy up _reader error handling 2013-02-22 16:57:44 +01:00
Steven Hiscocks
bf1ced5503 systemd-python: some python3 and bug fixes 2013-02-22 16:57:44 +01:00
Steven Hiscocks
6a71de70e5 systemd-python: implement this_boot/this_machine in Python 2013-02-22 16:57:43 +01:00
Steven Hiscocks
25523db4e1 systemd-python: Journal log_level moved to python 2013-02-22 16:57:43 +01:00
Zbigniew Jędrzejewski-Szmek
c1db45c6a5 sphinx: document Journal class too 2013-02-22 16:57:43 +01:00
Steven Hiscocks
3aa8f0861c systemd-python: move default call dicts from C to python 2013-02-22 16:57:43 +01:00
Steven Hiscocks
3ce2cc25bb systemd-python: MESSAGE_ID as UUID for Journal 2013-02-22 16:57:43 +01:00
Steven Hiscocks
2d0603bd97 systemd-python: moved PyRun_String to journal.py code 2013-02-22 16:57:43 +01:00
Steven Hiscocks
c4e9b5b557 systemd-python: add Journal class for reading journal 2013-02-22 16:57:43 +01:00
Zbigniew Jędrzejewski-Szmek
9015fa646e python: build html docs using sphinx
Build instructions:
   make
   make DESTIDIR=/tmp/... install
   make DESTIDIR=/tmp/... sphinx-html sphinx-man sphinx-epub ...
2013-02-22 16:57:43 +01:00