Commit graph

333 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
5a5063bac0 journal: allow stream() to be used without any arguments
It's fairly easy to provide a reasonable default for the first argument.
Let's do that.

Also, the documentation was misleading, suggesting that the function itself
can be passed as file parameter to print(). Use a different name for the
temporary variable to clarify that.
2016-10-17 04:10:06 -04:00
Zbigniew Jędrzejewski-Szmek
52d9f51b9b journal: bump default log level for stream() to INFO
By default debug messages are ignored, and INFO should be used for
"normal" messages.
2016-10-17 04:02:50 -04:00
Robert James Hernandez
aabbf9b40d Updating docs for missing dependency (#28)
I was trying to build python-systemd from source but ran into the same issue here: #17

I Figure the docs should be updated to reflect this dependency.
2016-10-10 20:11:10 -04:00
Zbigniew Jędrzejewski-Szmek
84fcfc05e5 setup.py: make build fail if undeclared symbols are used
This will detect cases where the autoconfig based on version is wrong.

Debian bug #839224.
2016-10-01 17:45:09 +02:00
Zbigniew Jędrzejewski-Szmek
911591a118 build-sys: import "pytest" instead of "py.test"
Fixes the following error in rawhide:
/usr/bin/python3: loader for pytest cannot handle py.test
2016-09-22 20:57:12 -04:00
Zbigniew Jędrzejewski-Szmek
8024fc6171 _reader: use proper ifdef guard for sd_j_open_files_fd 2016-09-22 20:57:12 -04:00
Zbigniew Jędrzejewski-Szmek
35a5b281ad tests: add workaround for pre-232 system returning EINVAL on some flags 2016-09-22 20:44:25 -04:00
Zbigniew Jędrzejewski-Szmek
c3c412f90e build-sys: add doc-sync target 2016-09-22 09:59:04 -04:00
Zbigniew Jędrzejewski-Szmek
b9767792b9 docs: fix sphinx format warning
build/lib.linux-x86_64-3.5/systemd/journal.py:docstring of systemd.journal.stream:15: WARNING: Literal block expected; none found.
2016-09-22 09:52:58 -04:00
Zbigniew Jędrzejewski-Szmek
177ac6d894 tests: skip fdstore tests if not implemented
Should fix #12.
2016-09-22 07:49:07 -04:00
Zbigniew Jędrzejewski-Szmek
34ce13054b Prepare v232 v232 2016-09-21 20:57:58 -04:00
Zbigniew Jędrzejewski-Szmek
3758d884d4 setup.py: change name to systemd-python
This name is unused on pypi. Let's grab it.
2016-09-21 20:57:58 -04:00
Zbigniew Jędrzejewski-Szmek
416efbf411 docs: autoregenerate id128.rst 2016-09-21 20:56:17 -04:00
Zbigniew Jędrzejewski-Szmek
d713eacb7e Store id128-constants.h in the repository
Instead of generating the list of message ids anew during every build,
the file is generated manually and committed into the
repository. Also, the list of defines is stored in id128-defines.h,
also kept in the repository. Both files should only grow.

This should make build easier. But it also fixes a problem with
systemd, which occasionally drops message definitions. We will keep
them forever, so it should be safe to rely on the presence of message
definitions which systemd does not use anymore.

Fixes #23.
2016-09-21 20:16:37 -04:00
Zbigniew Jędrzejewski-Szmek
9e0d797ba7 journal: convert seek_realtime argument to microseconds
This somewhat breaks backwards compatibility, but not for the
previously documented arguments: floats are now interpreted
differently, but ints and datetime.datetime objects are interpreted
the same as before. But the documentation clearly stated that only
ints and datetime.datetime objects were allowed.

This makes seek_realtime match seek_monotonic and other functions
which take time and follows the principle of least surprise.

Fixes #21.
2016-09-21 20:16:37 -04:00
Zbigniew Jędrzejewski-Szmek
5211952348 tests: use a context manager, skip new functions if missing 2016-09-21 15:32:58 -04:00
Zbigniew Jędrzejewski-Szmek
02b9432e73 reader: add SD_JOURNAL_OS_ROOT and rework flag passing
Let's pass any flags through to the journal functions without checking
validity. Those functions do their own checking, so there's no need to
second-guess.

The semantics for _Reader(flags=0) are a bit changed:
before, this would be transformed into sd_journal_open(SD_J_LOCAL_ONLY).
Now, this results in sd_journal_open(0). Previous behaviour should be
achieved by not specifying the flags at all.
This change is necessary, because previously it was not possible to
pass flags=0 to sd_journal_open(0), i.e. it was not possible to "merge"
journals through the Python interface.

Similarly, Reader(flags=0) now means to open all journals, and
Reader(flags=None) is the same as Reader(flags=LOCAL_ONLY).
2016-09-21 15:32:58 -04:00
Zbigniew Jędrzejewski-Szmek
89badf50b7 journal: add support for sd_journal_open_files_fd 2016-09-21 15:32:58 -04:00
Zbigniew Jędrzejewski-Szmek
ee9ab0bd65 journal: make sd_journal_enumerate return text strings
Those are field names and they should always be ASCII, and converting
them to str automatically makes the answer more useful.
2016-09-21 15:32:58 -04:00
Zbigniew Jędrzejewski-Szmek
dadcd3d723 journal: allow sd_journal_open_directory_fd to be used 2016-09-21 15:32:58 -04:00
Zbigniew Jędrzejewski-Szmek
42f627b302 Reformat documentation to be more PEP257-compliant
Wrapping the sources to ~80 columns means that the formatted output is
annoying to read. Rewrap to ~74 columns in the output.

Also remove some obsolete descritions of journal permissions and refer
to journalctl(1) instead.

Add some missing docstrings.
2016-09-20 09:38:36 -04:00
Zbigniew Jędrzejewski-Szmek
814cdb9d6a tests: check enumerate_fields, has_runtime_fiels, has_persistent_files 2016-09-20 09:38:18 -04:00
Zbigniew Jędrzejewski-Szmek
36a384a683 journal: add wrappers for sd_has_*_files 2016-09-20 09:38:14 -04:00
Zbigniew Jędrzejewski-Szmek
819ea77d1b journal: add wrapper for sd_journal_enumerate 2016-09-20 09:38:10 -04:00
Zbigniew Jędrzejewski-Szmek
ffba3a2ff8 journal: check errors properly in query_unique 2016-09-20 09:38:03 -04:00
Sebastian
8583a45b5c Makefile: correct path to generated docs 2016-09-15 22:31:21 +02:00
Sebastian
2e3512c656 Add Docs to README 2016-09-15 22:29:25 +02:00
Michael Biebl
4c6072f61b Fix typo (#26) 2016-07-16 11:20:52 -04:00
Benedikt Morbach
25f22209ea setup.py: respect ${PKG_CONFIG} if set (#18) 2016-05-28 16:38:02 -04:00
Nir Soffer
44acd1c9d1 readme: Use "raised" instead of "thrown"
Should be more familiar to the users of this library.
2016-05-28 22:48:11 +03:00
Nir Soffer
9fd0159c47 readme: Remove duplicate 'is thrown' 2016-05-28 22:45:16 +03:00
Ville Skyttä
4c5e850b49 Use log.warning instead of deprecated log.warn in example code 2016-05-21 08:50:13 +03:00
Ville Skyttä
947f782886 Spelling fixes 2016-05-21 08:47:00 +03:00
Mike Gilbert
87a9d64550 test_daemon: Define a default value for SO_PASSCRED
The socket module seems to be missing this in python2.7.
2016-01-20 19:08:02 -05:00
Michael Herold
3d046016c4 Fixes Reader.seek_monotonic(datetime.timedelta) 2015-12-10 00:18:01 +01:00
Zbigniew Jędrzejewski-Szmek
c8749e7fbc reader: avoid gcc warning
gcc warns that r might be uninitialized, because it doesn't
know that r will be initialized in the 'if' statement.

Initialize the variable to avoid the warning.
2015-12-02 20:44:15 -05:00
Zbigniew Jędrzejewski-Szmek
8ccd64789a tests: mirror is-systemd-running test from systemd v231 2015-10-28 10:02:53 -04:00
Zbigniew Jędrzejewski-Szmek
644e11f398 build-sys: make sure we use modules from the build dir
When running form the top source directory, sometimes modules
from systemd/ and not build/*/systemd/ were loaded.
2015-10-28 09:54:11 -04:00
Zbigniew Jędrzejewski-Szmek
94ee7ed0f9 build-sys: name html build directory after format
This way different outputs don't land in the same place.
2015-10-28 09:46:09 -04:00
Zbigniew Jędrzejewski-Szmek
45295d1b59 Bump version to 231 2015-10-27 08:25:15 -04:00
Zbigniew Jędrzejewski-Szmek
8176439058 build-sys: also put pytest.ini in the tarball
Without this tests don't seem to run properly with a build dir.
2015-10-27 08:17:58 -04:00
Zbigniew Jędrzejewski-Szmek
8d55a298d9 docs: remove SD_MESSAGE_CONFIG_ERROR from list
This list should be auto-generated... Let's remove the
ID that was removed from systemd from here too for now.
2015-10-27 00:26:37 -04:00
Zbigniew Jędrzejewski-Szmek
0576d32ed4 Add NEWS file 2015-10-27 00:13:38 -04:00
Zbigniew Jędrzejewski-Szmek
d31bfc3ba6 build-sys: add utility target to run tests 2015-10-27 00:12:11 -04:00
Zbigniew Jędrzejewski-Szmek
c1c55294f1 build-sys: add utility target to build TAGS 2015-10-27 00:07:18 -04:00
Zbigniew Jędrzejewski-Szmek
f83f19b3bd Python2 does not have ConnectionError 2015-10-27 00:07:18 -04:00
Zbigniew Jędrzejewski-Szmek
3217d17d0c build-sys: include tests in installation
This also allows tests to be run against he build directory:
$ py.test-2.7 -v build/lib.linux-x86_64-2.7 docs
$ py.test-3.4 -v build/lib.linux-x86_64-3.4 docs
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