summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Strauss <david@davidstrauss.net>2012-09-06 16:45:52 -0700
committerDavid Strauss <david@davidstrauss.net>2012-09-06 16:45:52 -0700
commit7ba24b5802998873df59bdb83b870897567be38e (patch)
tree4c77ea21ee053741b7fb9e3400cd1cb6fd196949
parent05bdd8ce12357776e2f6794d59f4f49e6d85d6b8 (diff)
downloadpython-systemd-7ba24b5802998873df59bdb83b870897567be38e.tar.gz
Make installable.
-rw-r--r--setup.py14
-rw-r--r--systemd/__init__.py0
-rw-r--r--systemd/_journal.c (renamed from journald/_journald.c)28
-rw-r--r--systemd/journal.py (renamed from journald/__init__.py)16
4 files changed, 29 insertions, 29 deletions
diff --git a/setup.py b/setup.py
index 4d8839c..bd4402f 100644
--- a/setup.py
+++ b/setup.py
@@ -1,13 +1,13 @@
from distutils.core import setup, Extension
-cjournald = Extension('journald/_journald',
+cjournal = Extension('systemd/_journal',
libraries = ['systemd-journal'],
- sources = ['journald/_journald.c'])
+ sources = ['systemd/_journal.c'])
-setup (name = 'journald',
+setup (name = 'systemd',
version = '0.1',
- description = 'Native interface to the journald facilities of systemd',
+ description = 'Native interface to the facilities of systemd',
author_email = 'david@davidstrauss.net',
- url = 'https://github.com/davidstrauss/journald-python',
- py_modules = ['journald'],
- ext_modules = [cjournald])
+ url = 'https://github.com/systemd/python-systemd',
+ py_modules = ['systemd.journal'],
+ ext_modules = [cjournal])
diff --git a/systemd/__init__.py b/systemd/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/systemd/__init__.py
diff --git a/journald/_journald.c b/systemd/_journal.c
index b713c73..8693978 100644
--- a/journald/_journald.c
+++ b/systemd/_journal.c
@@ -2,13 +2,13 @@
#define SD_JOURNAL_SUPPRESS_LOCATION
#include <systemd/sd-journal.h>
-PyDoc_STRVAR(journald_sendv__doc__,
+PyDoc_STRVAR(journal_sendv__doc__,
"sendv('FIELD=value', 'FIELD=value', ...) -> None\n\n"
- "Send an entry to journald."
+ "Send an entry to the journal."
);
static PyObject *
-journald_sendv(PyObject *self, PyObject *args) {
+journal_sendv(PyObject *self, PyObject *args) {
struct iovec *iov = NULL;
int argc = PyTuple_Size(args);
int i, r;
@@ -50,7 +50,7 @@ journald_sendv(PyObject *self, PyObject *args) {
// itself, unless an error occurs in one of the system calls.
errno = 0;
- // Send the iovector to journald.
+ // Send the iovector to the journal.
r = sd_journal_sendv(iov, argc);
if (r) {
@@ -79,13 +79,13 @@ out1:
return ret;
}
-PyDoc_STRVAR(journald_stream_fd__doc__,
+PyDoc_STRVAR(journal_stream_fd__doc__,
"stream_fd(identifier, priority, level_prefix) -> fd\n\n"
- "Open a stream to journald by calling sd_journal_stream_fd(3)."
+ "Open a stream to journal by calling sd_journal_stream_fd(3)."
);
static PyObject*
-journald_stream_fd(PyObject *self, PyObject *args) {
+journal_stream_fd(PyObject *self, PyObject *args) {
const char* identifier;
int priority, level_prefix;
int fd;
@@ -101,32 +101,32 @@ journald_stream_fd(PyObject *self, PyObject *args) {
}
static PyMethodDef methods[] = {
- {"sendv", journald_sendv, METH_VARARGS, journald_sendv__doc__},
- {"stream_fd", journald_stream_fd, METH_VARARGS,
- journald_stream_fd__doc__},
+ {"sendv", journal_sendv, METH_VARARGS, journal_sendv__doc__},
+ {"stream_fd", journal_stream_fd, METH_VARARGS,
+ journal_stream_fd__doc__},
{NULL, NULL, 0, NULL} /* Sentinel */
};
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC
-init_journald(void)
+init_journal(void)
{
- (void) Py_InitModule("_journald", methods);
+ (void) Py_InitModule("_journal", methods);
}
#else
static struct PyModuleDef module = {
PyModuleDef_HEAD_INIT,
- "_journald", /* name of module */
+ "_journal", /* name of module */
NULL, /* module documentation, may be NULL */
0, /* size of per-interpreter state of the module */
methods
};
PyMODINIT_FUNC
-PyInit__journald(void)
+PyInit_journal(void)
{
return PyModule_Create(&module);
}
diff --git a/journald/__init__.py b/systemd/journal.py
index f918b23..53e992b 100644
--- a/journald/__init__.py
+++ b/systemd/journal.py
@@ -2,7 +2,7 @@ import traceback as _traceback
import os as _os
from syslog import (LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR,
LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG)
-from ._journald import sendv, stream_fd
+from ._journal import sendv, stream_fd
def _make_line(field, value):
if isinstance(value, bytes):
@@ -15,9 +15,9 @@ def send(MESSAGE, MESSAGE_ID=None,
**kwargs):
r"""Send a message to journald.
- >>> journald.send('Hello world')
- >>> journald.send('Hello, again, world', FIELD2='Greetings!')
- >>> journald.send('Binary message', BINARY=b'\xde\xad\xbe\xef')
+ >>> journal.send('Hello world')
+ >>> journal.send('Hello, again, world', FIELD2='Greetings!')
+ >>> journal.send('Binary message', BINARY=b'\xde\xad\xbe\xef')
Value of the MESSAGE argument will be used for the MESSAGE= field.
@@ -26,8 +26,8 @@ def send(MESSAGE, MESSAGE_ID=None,
Other parts of the message can be specified as keyword arguments.
Both MESSAGE and MESSAGE_ID, if present, must be strings, and will
- be sent as UTF-8 to journald. Other arguments can be bytes, in
- which case they will be sent as-is to journald.
+ be sent as UTF-8 to journal. Other arguments can be bytes, in
+ which case they will be sent as-is to journal.
CODE_LINE, CODE_FILE, and CODE_FUNC can be specified to identify
the caller. Unless at least on of the three is given, values are
@@ -57,7 +57,7 @@ def send(MESSAGE, MESSAGE_ID=None,
return sendv(*args)
def stream(identifier, priority=LOG_DEBUG, level_prefix=False):
- r"""Return a file object wrapping a stream to journald.
+ r"""Return a file object wrapping a stream to journal.
Log messages written to this file as simple newline sepearted
text strings are written to the journal.
@@ -65,7 +65,7 @@ def stream(identifier, priority=LOG_DEBUG, level_prefix=False):
The file will be line buffered, so messages are actually sent
after a newline character is written.
- >>> stream = journald.stream('myapp')
+ >>> stream = journal.stream('myapp')
>>> stream
<open file '<fdopen>', mode 'w' at 0x...>
>>> stream.write('message...\n')