chiark / gitweb /
systemd-python: add __version__ strings
[elogind.git] / src / python-systemd / _daemon.c
index 8f93d91b48292e45a8af2e6b2a5587b39605db9a..d3b4807368aced0c0a07a825ab3851934fe8bc59 100644 (file)
@@ -244,7 +244,7 @@ static PyObject* is_socket_unix(PyObject *self, PyObject *args) {
         Py_ssize_t length = 0;
 
 #if PY_MAJOR_VERSION >=3 && PY_MINOR_VERSION >= 1
-        PyObject _cleanup_Py_DECREF_ *_path = NULL;
+        _cleanup_Py_DECREF_ PyObject *_path = NULL;
         if (!PyArg_ParseTuple(args, "i|iiO&:_is_socket_unix",
                               &fd, &type, &listening, Unicode_FSConverter, &_path))
                 return NULL;
@@ -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;
         }