Commit graph

333 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
dc1dae2eaa Version 235 v235
Fixes #76.
2022-08-16 15:50:06 +02:00
Zbigniew Jędrzejewski-Szmek
8360d1d01c
Merge pull request #117 from keszybz/python2-compat
Compat with python2
2022-08-16 12:20:44 +02:00
Zbigniew Jędrzejewski-Szmek
c5f8b887be NEWS: say that we'll drop support for python2 soon
I think it's nicer to make one last release with the remaining code
for python2 in place.
2022-08-16 11:03:09 +02:00
Zbigniew Jędrzejewski-Szmek
cc03ed6d20 tests: simplify imports
'import foo as _foo' is useful in exported modules to avoid 'foo' being
present in the public API. No need to play that game in test code.
2022-08-16 11:03:09 +02:00
Zbigniew Jędrzejewski-Szmek
ba9d9f8910 tests: python2-compat in another place 2022-08-16 11:03:09 +02:00
Zbigniew Jędrzejewski-Szmek
872ce304a0 journal: fix compatibility with python2
This is a lazy workaround: 4c9a241949
is amended to do nothing on python2, so we have the same issue that
was present before. This allows the code to execute, and hopefully
almost nobody is using python2 code anyway.

f868a56b93 is amended in the same way.
For python2 code we have the same lack of timezone-awareness as before.

This allows the tests to pass under python 2.7.
2022-08-16 11:03:09 +02:00
Zbigniew Jędrzejewski-Szmek
6320847472
Merge pull request #92 from chrismullins/support-realtime-cutoff
Support realtime cutoff access
2022-08-16 09:55:39 +02:00
Zbigniew Jędrzejewski-Szmek
8b92ac57d6
Merge pull request #114 from keszybz/install-docs
Update/clean-up installation instructions
2022-08-16 09:44:26 +02:00
Frantisek Sumsal
fe4450ee3e ci: run CIs on push events as well
Let's cover merges into main with CIs too.
2022-08-15 21:42:32 +00:00
Zbigniew Jędrzejewski-Szmek
65b1c19258 README: apt-get → apt
Based on Jörg Behrmann's comment:
https://github.com/systemd/python-systemd/pull/114#discussion_r945896280
> apt is available in the stretch, which is the oldest listed [1] release for it
> and stretch has already ended LTS support.

[1] https://packages.debian.org/bullseye/apt
2022-08-15 19:29:28 +02:00
Zbigniew Jędrzejewski-Szmek
05773b4548 README: drop distro instructions for python2, drop epel/rhel
Fedora has no python2 package, so drop that.
Similarly, with latest Debian and Opensuse, 'apt-get install
python3-systemd' works, but 'apt-get install python-systemd' doesn't.

(Tested with
podman run -it --rm debian apt-get install python3-systemd
mock -r opensuse-tumbleweed-x86_64 --enable-network -i python3-systemd)

It also seems we never built the package in EPEL, so let's drop
RHEL/CentOS from the list.

If people need to, they can install from sources where the distro
packages are unavailable (and they shouldn't be using python2 anyway
at this point.)

Also add 'apt-get update' into the instructions because w/o that
install does not work in a pristine container.

Fixes #78.
2022-08-15 17:50:38 +02:00
Zbigniew Jędrzejewski-Szmek
d361f0bfa5 Update constants for systemd 251 2022-08-15 16:59:02 +02:00
Zbigniew Jędrzejewski-Szmek
e261fc0a7e README: markup and line wrapping
Bash doesn't do anything special for a command with '#', but at least
zsh treat it as a comment. It's better to quote such a commandline.
2022-08-15 16:56:40 +02:00
Zbigniew Jędrzejewski-Szmek
8659af2179 README: fix installation urls
pip3 install says:
WARNING: Discarding git+https://github.com/systemd/python-systemd.git#egg=systemd. Requested systemd-python from git+https://github.com/systemd/python-systemd.git#egg=systemd has inconsistent name: filename has 'systemd', but metadata has
 'systemd-python'

Closes #97.
2022-08-15 16:56:40 +02:00
Zbigniew Jędrzejewski-Szmek
75066b51aa
Merge pull request #111 from keszybz/setuptools-compat
make: fix compat with setuptools >= 61
2022-08-13 21:27:47 +02:00
Zbigniew Jędrzejewski-Szmek
23b329d253 ci: add 3.11 to the test matrix 2022-08-13 21:18:52 +02:00
Zbigniew Jędrzejewski-Szmek
09053a2139 make: fix compat with setuptools >= 61
Fixes #110.
2022-08-13 20:56:48 +02:00
Samuel BF
f868a56b93 Adding timezone information to datetimes from systemd-journal 2022-08-13 19:34:51 +02:00
Andrew Stone
1abac3cfec reader: Fix use of potentially uninitialized value 2022-08-13 17:03:30 +02:00
Tim Orling
44f7d19536 setup.py: switch from distutils to setuptools
In Python 3.10, distutils is deprecated and slated for removal in Python
3.12. It also prevents 'setup.py bdist_wheel' from building a wheel.

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
2022-08-13 17:02:37 +02:00
Zbigniew Jędrzejewski-Szmek
04ee44d230
Merge pull request #104 from systemd/ci-shenanigans
ci: move the CI to GitHub Actions
2022-08-13 16:57:31 +02:00
Dan Bungert
671dc03e06 Update news since 234 2022-08-13 16:48:32 +02:00
Federico Ceratto
21d9b1664d Set unit name in JournalHandler example, see #74 2022-08-13 16:47:50 +02:00
Zbigniew Jędrzejewski-Szmek
e6b457fb1e
Merge pull request #91 from chrismullins/journal-examples
Journal examples
2022-08-13 16:46:20 +02:00
Architector #4
b109b7587d fix a mistype in README.md
"libsytemd" should obviously be "libsystemd"
2022-06-23 21:07:39 +02:00
Frantisek Sumsal
884a43eb2e ci: introduce a simple install test 2022-04-14 13:10:36 +02:00
Frantisek Sumsal
720d3cb738 ci: move the CI to GitHub Actions 2022-04-14 13:09:54 +02:00
Frantisek Sumsal
76e7478a34 Makefile: accept $SPHINXOPTS from the outside 2022-03-06 19:25:47 +01:00
Chris Mullins
d6b3af95f5 Pass NULL for unnecessary timestamps 2021-01-03 01:34:48 +00:00
Chris Mullins
9bb147c26b Add support for sd_journal_get_cutoff_realtime_usec wrapper 2021-01-03 01:22:22 +00:00
Chris Mullins
1088520535 Add link to journal fields docs 2021-01-02 23:12:15 +00:00
Chris Mullins
1532b67c51 Add journalctl example for ring buffer 2021-01-02 23:07:49 +00:00
Chris Mullins
86ad413dfc Add some examples 2021-01-02 23:05:35 +00:00
Glandos
2166b5759c journal: remove ChainMap
"after some quick testing, the execution time got halved (32-ish
seconds to 16-ish seconds) when going through all journal entries."

Closes #63.
2020-11-12 19:19:47 +01:00
Alexander Olekhnovich
9cbc4e93b4 journal: add namespace support
Add log namespace support which is added since systemd v245
2020-11-12 19:10:13 +01:00
Tamaki Nishino
5dd8afda3e journal: allow JournalHandler constructor to be called with args in a positional param
This change enables to add extra fields to JournalHandler in a
configuration file loaded by `logging.config.fileConfig`, which only allows positional
parameters:

class=systemd.journal.JournalHandler
args={'level': INFO, 'SYSLOG_IDENTIFIER': 'my-cool-app'}

[zj: originally the patch added a new positional parameter to
__init__(), but that is not backwards compatible. So I added a new
classmethod to allow the positional parameters to be passed.]
2020-11-12 19:05:37 +01:00
Zbigniew Jędrzejewski-Szmek
397dec7411 test: make sure $NOTIFY_SOCKET is unset in test
When running the tests in Fedora's mock, the test would
fail because NOTIFY_SOCKET is set to /run/systemd/nspawn/notify, and
we get a permission error.
2020-11-12 17:20:05 +01:00
Zbigniew Jędrzejewski-Szmek
c71bbac357 reader: make PY_SSIZE_T_CLEAN 2020-11-12 17:14:34 +01:00
Zbigniew Jędrzejewski-Szmek
9bacacace4 journal: avoid warning about deprecated constant 2020-11-12 17:14:34 +01:00
Léonard Gérard
4c9a241949 Fix seek_realtime to work with timezone aware date
`strftime("%s")` is not in the official python documentation but in my system (ubuntu 18.04 python 3.6.9) it is not aware of the object timezone and will return the wrong value if the timezone is specified and is not the system local one.

There are multiple ways to ensure a python `datetime.datetime` is in local timezone, the easiest (with python 3.3+) is to call `.astimezone()` If one wants to support earlier versions of python an extra dependency might be needed like `dateutil.tz.tzlocal()`.
2020-11-12 08:50:25 +01:00
Dominik Prien
d08f8dd0f4 make: Move -std=99 to setup.py 2020-11-11 22:38:04 +01:00
Khem Raj
ced5a20986 include endian.h for htobe16 definition 2020-11-11 22:37:22 +01:00
Hendrikto
4cfc17e862 Fix a typo 2020-11-11 22:36:55 +01:00
Zbigniew Jędrzejewski-Szmek
a402d08da4 docs: mention .process() in docstring of .fileno()
Together with the previous commit, this makes it much easier to find
the right docs. Fixes #48.
2019-06-16 19:49:54 +02:00
Zbigniew Jędrzejewski-Szmek
42ec43022e docs: use :manpage: role to provide links to systemd man pages
See https://github.com/sphinx-doc/sphinx/pull/4235 for the :manpage:
role.
2019-06-16 19:38:13 +02:00
Zbigniew Jędrzejewski-Szmek
b88119d2b5 make: fix "make doc" invocations
python insists on adding . to python.path, so we always import the systemd
in the top-level directory instead of the one in build/ that we want. Let's
cd into docs/ first, so that we get the right module imported.

Also, replace sphinx-build calls with $(PYTHON) -m sphinx. This has the
advantage that once $(PYTHON) is set, the appropriate sphinx executable is
chosen.
2019-06-16 19:34:39 +02:00
Zbigniew Jędrzejewski-Szmek
1cb0b342a2 Document libsystemd compatiblity
Closes #49.
2019-06-16 18:19:15 +02:00
Zbigniew Jędrzejewski-Szmek
343f97460f Use #if instead of #ifdef for compatibility checks
This has the advantage that it is slightly less verbose, and
also any potential typos in the macro names are immediately detected.
2019-06-16 18:12:45 +02:00
Zbigniew Jędrzejewski-Szmek
a17f3c0ec5 make: use -std=c99
I see no good reason to support old standards, when systemd itself
requires c99. Let's test with c99 in the CI.

Closes #62.
2019-06-16 17:37:53 +02:00
Zbigniew Jędrzejewski-Szmek
36c57e52be id128: update constants for systmed-243 2019-06-16 16:27:11 +02:00