summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Strauss <david@davidstrauss.net>2012-06-25 23:02:40 -0700
committerDavid Strauss <david@davidstrauss.net>2012-06-25 23:02:40 -0700
commitcb38f73edecc9b80fc89dde03766a546d5e25629 (patch)
tree0d94649f671fae22905996131050c62022276892
parenta472ade603a1edec208409036d269d7eca5b1f3f (diff)
downloadpython-systemd-cb38f73edecc9b80fc89dde03766a546d5e25629.tar.gz
Initial boilerplate work. Compiles without warnings. Untested.
-rw-r--r--README.md10
-rw-r--r--journald.c34
-rw-r--r--setup.py9
3 files changed, 52 insertions, 1 deletions
diff --git a/README.md b/README.md
index 9e839be..125021f 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,12 @@
journald-python
===============
-Python module for native access to systemd's journald facilities \ No newline at end of file
+Python module for native access to systemd's journald facilities
+
+Installation
+============
+
+On Fedora 17:
+
+sudo yum install git python-pip gcc python-devel systemd-devel
+pip-python git+http://github.com/davidstrauss/journald-python.git#egg=journald
diff --git a/journald.c b/journald.c
new file mode 100644
index 0000000..5f9d41b
--- /dev/null
+++ b/journald.c
@@ -0,0 +1,34 @@
+#include <Python.h>
+#include <systemd/sd-journal.h>
+
+#ifndef journaldpython
+#define journaldpython
+
+static PyObject *
+journald_send(PyObject *self, PyObject *args)
+{
+ //const char *command;
+ //int sts;
+
+ //if (!PyArg_ParseTuple(args, "s", &command))
+ // return NULL;
+ //sts = system(command);
+ //return Py_BuildValue("i", sts);
+ sd_journal_send("Test message: %s.", "arg1", NULL);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyMethodDef journaldMethods[] = {
+ {"send", journald_send, METH_VARARGS,
+ "Send an entry to journald."},
+ {NULL, NULL, 0, NULL} /* Sentinel */
+};
+
+PyMODINIT_FUNC
+initjournal(void)
+{
+ (void) Py_InitModule("journald", journaldMethods);
+}
+
+#endif
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..ba34a4b
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,9 @@
+from distutils.core import setup, Extension
+
+journald = Extension('journald',
+ sources = ['journald.c'])
+
+setup (name = 'journald',
+ version = '0.1',
+ description = 'Native interface to the journald facilities of systemd',
+ ext_modules = [journald])