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.
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.
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>
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.]
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.
`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()`.
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.