summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/journal/sd-journal.c2
-rw-r--r--src/python-systemd/_daemon.c4
-rw-r--r--src/python-systemd/_journal.c21
-rw-r--r--src/python-systemd/_reader.c4
-rw-r--r--src/python-systemd/daemon.py3
-rw-r--r--src/python-systemd/id128.c5
-rw-r--r--src/python-systemd/journal.py2
7 files changed, 31 insertions, 10 deletions
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index d81e4ddfa9..c21712b7c4 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -415,7 +415,7 @@ _public_ void sd_journal_flush_matches(sd_journal *j) {
}
static int compare_entry_order(JournalFile *af, Object *_ao,
- JournalFile *bf, uint64_t bp) {
+ JournalFile *bf, uint64_t bp) {
uint64_t a, b;
Object *ao, *bo;
diff --git a/src/python-systemd/_daemon.c b/src/python-systemd/_daemon.c
index ce2064935d..d3b4807368 100644
--- a/src/python-systemd/_daemon.c
+++ b/src/python-systemd/_daemon.c
@@ -291,6 +291,7 @@ PyMODINIT_FUNC init_daemon(void) {
return;
PyModule_AddIntConstant(m, "LISTEN_FDS_START", SD_LISTEN_FDS_START);
+ PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION);
}
#else
@@ -310,7 +311,8 @@ PyMODINIT_FUNC PyInit__daemon(void) {
if (m == NULL)
return NULL;
- if (PyModule_AddIntConstant(m, "LISTEN_FDS_START", SD_LISTEN_FDS_START)) {
+ if (PyModule_AddIntConstant(m, "LISTEN_FDS_START", SD_LISTEN_FDS_START) ||
+ PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION)) {
Py_DECREF(m);
return NULL;
}
diff --git a/src/python-systemd/_journal.c b/src/python-systemd/_journal.c
index 2de0d4f91d..f8e0b4f7f2 100644
--- a/src/python-systemd/_journal.c
+++ b/src/python-systemd/_journal.c
@@ -119,7 +119,13 @@ static PyMethodDef methods[] = {
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC init_journal(void) {
- (void) Py_InitModule("_journal", methods);
+ PyObject *m;
+
+ m = Py_InitModule("_journal", methods);
+ if (m == NULL)
+ return;
+
+ PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION);
}
#else
@@ -133,7 +139,18 @@ static struct PyModuleDef module = {
};
PyMODINIT_FUNC PyInit__journal(void) {
- return PyModule_Create(&module);
+ PyObject *m;
+
+ m = PyModule_Create(&module);
+ if (m == NULL)
+ return NULL;
+
+ if (PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION)) {
+ Py_DECREF(m);
+ return NULL;
+ }
+
+ return m;
}
#endif
diff --git a/src/python-systemd/_reader.c b/src/python-systemd/_reader.c
index b836597746..50ad889201 100644
--- a/src/python-systemd/_reader.c
+++ b/src/python-systemd/_reader.c
@@ -30,6 +30,7 @@
#include "pyutil.h"
#include "macro.h"
#include "util.h"
+#include "build.h"
typedef struct {
PyObject_HEAD
@@ -1126,7 +1127,8 @@ init_reader(void)
PyModule_AddIntConstant(m, "INVALIDATE", SD_JOURNAL_INVALIDATE) ||
PyModule_AddIntConstant(m, "LOCAL_ONLY", SD_JOURNAL_LOCAL_ONLY) ||
PyModule_AddIntConstant(m, "RUNTIME_ONLY", SD_JOURNAL_RUNTIME_ONLY) ||
- PyModule_AddIntConstant(m, "SYSTEM_ONLY", SD_JOURNAL_SYSTEM_ONLY)) {
+ PyModule_AddIntConstant(m, "SYSTEM_ONLY", SD_JOURNAL_SYSTEM_ONLY) ||
+ PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION)) {
#if PY_MAJOR_VERSION >= 3
Py_DECREF(m);
return NULL;
diff --git a/src/python-systemd/daemon.py b/src/python-systemd/daemon.py
index 4a02204433..e2829d1671 100644
--- a/src/python-systemd/daemon.py
+++ b/src/python-systemd/daemon.py
@@ -1,4 +1,5 @@
-from ._daemon import (booted,
+from ._daemon import (__version__,
+ booted,
_listen_fds,
_is_fifo,
_is_socket,
diff --git a/src/python-systemd/id128.c b/src/python-systemd/id128.c
index 1c2fe5dd0b..ec1d9fb4a2 100644
--- a/src/python-systemd/id128.c
+++ b/src/python-systemd/id128.c
@@ -19,8 +19,6 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <stdbool.h>
-
#include <Python.h>
#include <systemd/sd-messages.h>
@@ -126,6 +124,7 @@ PyMODINIT_FUNC initid128(void) {
#define JOINER ;
#include "id128-constants.h"
#undef JOINER
+ PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION);
}
#else
@@ -149,7 +148,7 @@ PyMODINIT_FUNC PyInit_id128(void) {
#define JOINER ||
#include "id128-constants.h"
#undef JOINER
- false) {
+ PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION)) {
Py_DECREF(m);
return NULL;
}
diff --git a/src/python-systemd/journal.py b/src/python-systemd/journal.py
index 9e40cbc57e..9ef1ede229 100644
--- a/src/python-systemd/journal.py
+++ b/src/python-systemd/journal.py
@@ -31,7 +31,7 @@ if _sys.version_info >= (3,3):
from collections import ChainMap as _ChainMap
from syslog import (LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR,
LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG)
-from ._journal import sendv, stream_fd
+from ._journal import __version__, sendv, stream_fd
from ._reader import (_Reader, NOP, APPEND, INVALIDATE,
LOCAL_ONLY, RUNTIME_ONLY, SYSTEM_ONLY,
_get_catalog)