Commit graph

139 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
8ccd64789a tests: mirror is-systemd-running test from systemd 2015-10-28 10:02:53 -04:00
Zbigniew Jędrzejewski-Szmek
f83f19b3bd Python2 does not have ConnectionError 2015-10-27 00:07:18 -04:00
Zbigniew Jędrzejewski-Szmek
a947f32b31 tests: add tests for notify() 2015-10-26 23:38:58 -04:00
Zbigniew Jędrzejewski-Szmek
6baa4b417b daemon: wrap sd_pid_notify[_with_pids]
Closes #8.
2015-10-26 22:51:27 -04:00
Zbigniew Jędrzejewski-Szmek
035700c2b5 Merge branch 'tests' 2015-10-25 16:51:04 -04:00
Zbigniew Jędrzejewski-Szmek
1d8f5f26df tests: work around bug in sd_is_mq
The fix was committed in v226-362-g0260d1d542.
2015-10-25 16:50:59 -04:00
Zbigniew Jędrzejewski-Szmek
4be2fc75bf Do not assume specific output from the journal
While we *usually* get those messages from udev, in many tests environments
this will not be true, so just do not try to check the output at all.
2015-10-25 12:23:29 -04:00
Zbigniew Jędrzejewski-Szmek
173c2a89b2 tests: add simplistic tests for Reader matches
It would be nice to run those tests against fake journal files
with the right content to actually test the matches. But those
tests are still useful because they test that the interface
works as expected.
2015-09-16 12:43:06 +02:00
Zbigniew Jędrzejewski-Szmek
4f5aa7b54a journal: allow numbers in field identifiers 2015-09-17 11:53:45 +02:00
Zbigniew Jędrzejewski-Szmek
bbbc6e8a92 tests: add tests for Reader initialization 2015-09-17 11:53:45 +02:00
Zbigniew Jędrzejewski-Szmek
008aac74d7 journal: reindent to 4 spaces 2015-09-17 11:53:45 +02:00
Zbigniew Jędrzejewski-Szmek
5bf468dca1 tests: start adding tests for JournalHandler 2015-09-17 11:53:45 +02:00
Zbigniew Jędrzejewski-Szmek
5f36e8647a Normalize some strange indentation 2015-09-08 10:36:16 +02:00
Zbigniew Jędrzejewski-Szmek
085db21e5e tests: add more tests for socket functions 2015-09-06 18:54:55 +02:00
Zbigniew Jędrzejewski-Szmek
e6b305b41a tests: adapt to python2.7 output again 2015-09-05 14:23:20 +02:00
Zbigniew Jędrzejewski-Szmek
0cf0cf7e42 tests: daemon.booted 2015-09-05 14:18:32 +02:00
Zbigniew Jędrzejewski-Szmek
2e115f3c4f tests: daemon.listen_fds 2015-09-05 14:18:23 +02:00
Zbigniew Jędrzejewski-Szmek
cc5f218a50 tests: enable doctests in the sources
Unfortunately the "standard" way to access the names in the
defined module does not work. I find it nicer to explicitly import,
e.g. from systemd import journal, because then the examples
correspond more closely to what a user would use. The only
exception is made for JournalHandler, because journal.JournalHandler
is a tad to long.
2015-09-05 13:09:43 +02:00
Evgeny Vereshchagin
b71b8b64eb Fix booted() doc 2015-09-04 18:30:10 +02:00
Zbigniew Jędrzejewski-Szmek
f83dea9f8d Add compatibility with systemd < 205 2015-09-04 17:16:28 +02:00
Zbigniew Jędrzejewski-Szmek
a93828172f tests: add first test
This is based on the code in https://github.com/systemd/python-systemd/pull/4
by Jacek Konieczny <j.konieczny@eggsoft.pl>.
2015-08-07 11:49:56 -04:00
Zbigniew Jędrzejewski-Szmek
d2bc513440 tree-wide: systemd→python-systemd in headers 2015-08-07 11:49:56 -04:00
Jacek Konieczny
71d82616a8 Fix daemon.is_fifo and .is_mq under Python 3
The 'path' parameter was not properly converted from Unicode
and the functions would always fail when a path was provided.

https://github.com/systemd/python-systemd/pull/4
2015-08-07 11:49:42 -04:00
Zbigniew Jędrzejewski-Szmek
1ad7f56b90 Move docs to top level and include in manifest 2015-07-08 13:45:03 -04:00
Zbigniew Jędrzejewski-Szmek
410f054ddf Update LICENSE file and classifiers
The license was originally MIT, but when this module became part of systemd,
it was changed to LGPLv2+. All files had correct headers, so only the LICENSE
file needs updating. Take the opportunity to add classifiers to setup.py.
2015-07-05 20:16:51 -04:00
Zbigniew Jędrzejewski-Szmek
31baccc855 build-sys: update setup.py to build everything 2015-07-05 15:10:30 -04:00
Kay Sievers
2a3fc158a5 remove gudev and gtk-doc
The library moved to:
  https://git.gnome.org/browse/libgudev/
2015-07-05 14:19:22 -04:00
Simon Farnsworth
d6c4257815 python-systemd: fix is_socket_inet to cope with ports
Just a couple of trivial oversights.
2015-07-05 14:19:22 -04:00
Dave Reisner
7ea37c0d40 python-systemd: avoid hitting assert in __exit__
Reader_close() asserts that 'args' is always NULL, but the __exit__
function forwards a non-NULL args.
2015-07-05 14:19:22 -04:00
Zbigniew Jędrzejewski-Szmek
a68a57ed71 Always prefer our headers to system headers
In practice this shouldn't make much difference, but
sometimes our headers might be newer, and we want to
test them.
2015-07-05 14:19:22 -04:00
Zbigniew Jędrzejewski-Szmek
4398250261 systemd-python: fix failing assert
A parameter which was always null before, now get's set to
the module.
2015-07-05 14:19:21 -04:00
Zbigniew Jędrzejewski-Szmek
583f1a9441 systemd-python: use .hex instead of .get_hex()
It turns out the latter got removed in Python 3.

https://bugs.freedesktop.org/show_bug.cgi?id=77086
2015-07-05 14:19:21 -04:00
Lennart Poettering
f7cf47eb64 python: reindent _reader.c
All files should follow our coding style, and that means 8ch indenting.
Let's correct that.
2015-07-05 14:19:21 -04:00
Lennart Poettering
ce4e46ae66 macro: introduce nice macro for disabling -Wmissing-prototypes warnigs 2015-07-05 14:19:21 -04:00
Lennart Poettering
5e1d42a180 util: use alloca0() intead of alloca() + memzero() 2015-07-05 14:19:21 -04:00
Greg KH
5cf9be60ca use memzero(foo, length); for all memset(foo, 0, length); calls
In trying to track down a stupid linker bug, I noticed a bunch of
memset() calls that should be using memzero() to make it more "obvious"
that the options are correct (i.e. 0 is not the length, but the data to
set).  So fix up all current calls to memset(foo, 0, length) to
memzero(foo, length).
2015-07-05 14:19:21 -04:00
Zbigniew Jędrzejewski-Szmek
d109c7035f systemd-python: fix listen_fds under Python 2 2015-07-05 14:19:21 -04:00
Zbigniew Jędrzejewski-Szmek
73f327ce21 systemd-python: fix setting of exception codes
The return value of 0 would be treated as failure by mistake,
resulting in " SystemError: error return without exception set".
The way that set_error() is used is changed to be the same
everywhere.
2015-07-05 14:19:21 -04:00
Thomas Hindoe Paaboel Andersen
2ebe9bf6c3 trivial coding style clean ups
- Add space between if/for and the opening parentheses
- Place the opening brace on same line as the function (not for  udev)

From the CODING_STYLE
Try to use this:
    void foo() {
    }
instead of this:
    void foo()
    {
    }
2015-07-05 14:19:21 -04:00
Zbigniew Jędrzejewski-Szmek
07c1d9a144 systemd-python: fix booted() and add two functions to docs
For some reason sphinx doesn't want to show inherited C functions.
2015-07-05 14:19:21 -04:00
Richard Marko
7bb40a26e0 systemd-python: convert keyword value to string
Allows using journal.send('msg', PRIORITY=journal.LOG_CRIT)

Before this commit this results in
TypeError: cannot concatenate 'str' and 'int' objects
and requires passing PRIORITY value as string to work.
2015-07-05 14:19:21 -04:00
Zbigniew Jędrzejewski-Szmek
39970127f2 systemd-python: check for oom, give nicer error messages 2015-07-05 14:19:21 -04:00
Steven Hiscocks
ec9078e45e systemd-python: fix initialization of _Reader objects
https://bugzilla.redhat.com/show_bug.cgi?id=995575
2015-07-05 14:19:21 -04:00
Zbigniew Jędrzejewski-Szmek
ac8b2b3eb3 systemd-python: fix gcc warning
src/python-systemd/_reader.c: In function Reader_get_catalog:
src/python-systemd/_reader.c:912:53: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             assert(mid_len > l);
                            ^
2015-07-05 14:19:21 -04:00
Zbigniew Jędrzejewski-Szmek
7583998db7 systemd-python: use modern C 2015-07-05 14:19:20 -04:00
Zbigniew Jędrzejewski-Szmek
c0d8b4e810 systemd-python: also update the documentation
sphinx, oh sphinx, why do you require manual ficksups all the time?
2015-07-05 14:19:20 -04:00
Zbigniew Jędrzejewski-Szmek
2bfb849c70 systemd-python: add support for sd_j_open_files
Also export missing flags.
2015-07-05 14:19:20 -04:00
Zbigniew Jędrzejewski-Szmek
2c0317be82 systemd-python: fix iteration
Back in 6a58bf4135 raising stop iteration was removed from the C
code, but wasn't added in the Python counterpart.
2015-07-05 14:19:20 -04:00
Zbigniew Jędrzejewski-Szmek
d9a07b11ea systemd-python: wrap sd_notify
_listen_fds() is modified to accept unset_environment arg as keyword,
to match new notify().
2015-07-05 14:19:20 -04:00
Zbigniew Jędrzejewski-Szmek
0a3463cd5b journal: add ability to filter by current user
This is the just the library part.

SD_JOURNAL_CURRENT_USER flags is added to sd_j_open(), to open
files from current user.

SD_JOURNAL_SYSTEM_ONLY is renamed to SD_JOURNAL_SYSTEM,
and changed to mean to (also) open system files. This way various
flags can be combined, which gives them nicer semantics, especially
if other ones are added later.

Backwards compatibility is kept, because SD_JOURNAL_SYSTEM_ONLY
is equivalent to SD_JOURNAL_SYSTEM if used alone, and before there
we no other flags.
2015-07-05 14:19:20 -04:00