Skip to content

Commit 7ba24b5

Browse files
committed
Make installable.
1 parent 05bdd8c commit 7ba24b5

File tree

4 files changed

+29
-29
lines changed

4 files changed

+29
-29
lines changed

setup.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from distutils.core import setup, Extension
22

3-
cjournald = Extension('journald/_journald',
3+
cjournal = Extension('systemd/_journal',
44
libraries = ['systemd-journal'],
5-
sources = ['journald/_journald.c'])
5+
sources = ['systemd/_journal.c'])
66

7-
setup (name = 'journald',
7+
setup (name = 'systemd',
88
version = '0.1',
9-
description = 'Native interface to the journald facilities of systemd',
9+
description = 'Native interface to the facilities of systemd',
1010
author_email = 'david@davidstrauss.net',
11-
url = 'https://github.com/davidstrauss/journald-python',
12-
py_modules = ['journald'],
13-
ext_modules = [cjournald])
11+
url = 'https://github.com/systemd/python-systemd',
12+
py_modules = ['systemd.journal'],
13+
ext_modules = [cjournal])

systemd/__init__.py

Whitespace-only changes.
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
#define SD_JOURNAL_SUPPRESS_LOCATION
33
#include <systemd/sd-journal.h>
44

5-
PyDoc_STRVAR(journald_sendv__doc__,
5+
PyDoc_STRVAR(journal_sendv__doc__,
66
"sendv('FIELD=value', 'FIELD=value', ...) -> None\n\n"
7-
"Send an entry to journald."
7+
"Send an entry to the journal."
88
);
99

1010
static PyObject *
11-
journald_sendv(PyObject *self, PyObject *args) {
11+
journal_sendv(PyObject *self, PyObject *args) {
1212
struct iovec *iov = NULL;
1313
int argc = PyTuple_Size(args);
1414
int i, r;
@@ -50,7 +50,7 @@ journald_sendv(PyObject *self, PyObject *args) {
5050
// itself, unless an error occurs in one of the system calls.
5151
errno = 0;
5252

53-
// Send the iovector to journald.
53+
// Send the iovector to the journal.
5454
r = sd_journal_sendv(iov, argc);
5555

5656
if (r) {
@@ -79,13 +79,13 @@ journald_sendv(PyObject *self, PyObject *args) {
7979
return ret;
8080
}
8181

82-
PyDoc_STRVAR(journald_stream_fd__doc__,
82+
PyDoc_STRVAR(journal_stream_fd__doc__,
8383
"stream_fd(identifier, priority, level_prefix) -> fd\n\n"
84-
"Open a stream to journald by calling sd_journal_stream_fd(3)."
84+
"Open a stream to journal by calling sd_journal_stream_fd(3)."
8585
);
8686

8787
static PyObject*
88-
journald_stream_fd(PyObject *self, PyObject *args) {
88+
journal_stream_fd(PyObject *self, PyObject *args) {
8989
const char* identifier;
9090
int priority, level_prefix;
9191
int fd;
@@ -101,32 +101,32 @@ journald_stream_fd(PyObject *self, PyObject *args) {
101101
}
102102

103103
static PyMethodDef methods[] = {
104-
{"sendv", journald_sendv, METH_VARARGS, journald_sendv__doc__},
105-
{"stream_fd", journald_stream_fd, METH_VARARGS,
106-
journald_stream_fd__doc__},
104+
{"sendv", journal_sendv, METH_VARARGS, journal_sendv__doc__},
105+
{"stream_fd", journal_stream_fd, METH_VARARGS,
106+
journal_stream_fd__doc__},
107107
{NULL, NULL, 0, NULL} /* Sentinel */
108108
};
109109

110110
#if PY_MAJOR_VERSION < 3
111111

112112
PyMODINIT_FUNC
113-
init_journald(void)
113+
init_journal(void)
114114
{
115-
(void) Py_InitModule("_journald", methods);
115+
(void) Py_InitModule("_journal", methods);
116116
}
117117

118118
#else
119119

120120
static struct PyModuleDef module = {
121121
PyModuleDef_HEAD_INIT,
122-
"_journald", /* name of module */
122+
"_journal", /* name of module */
123123
NULL, /* module documentation, may be NULL */
124124
0, /* size of per-interpreter state of the module */
125125
methods
126126
};
127127

128128
PyMODINIT_FUNC
129-
PyInit__journald(void)
129+
PyInit_journal(void)
130130
{
131131
return PyModule_Create(&module);
132132
}
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os as _os
33
from syslog import (LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR,
44
LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG)
5-
from ._journald import sendv, stream_fd
5+
from ._journal import sendv, stream_fd
66

77
def _make_line(field, value):
88
if isinstance(value, bytes):
@@ -15,9 +15,9 @@ def send(MESSAGE, MESSAGE_ID=None,
1515
**kwargs):
1616
r"""Send a message to journald.
1717
18-
>>> journald.send('Hello world')
19-
>>> journald.send('Hello, again, world', FIELD2='Greetings!')
20-
>>> journald.send('Binary message', BINARY=b'\xde\xad\xbe\xef')
18+
>>> journal.send('Hello world')
19+
>>> journal.send('Hello, again, world', FIELD2='Greetings!')
20+
>>> journal.send('Binary message', BINARY=b'\xde\xad\xbe\xef')
2121
2222
Value of the MESSAGE argument will be used for the MESSAGE= field.
2323
@@ -26,8 +26,8 @@ def send(MESSAGE, MESSAGE_ID=None,
2626
Other parts of the message can be specified as keyword arguments.
2727
2828
Both MESSAGE and MESSAGE_ID, if present, must be strings, and will
29-
be sent as UTF-8 to journald. Other arguments can be bytes, in
30-
which case they will be sent as-is to journald.
29+
be sent as UTF-8 to journal. Other arguments can be bytes, in
30+
which case they will be sent as-is to journal.
3131
3232
CODE_LINE, CODE_FILE, and CODE_FUNC can be specified to identify
3333
the caller. Unless at least on of the three is given, values are
@@ -57,15 +57,15 @@ def send(MESSAGE, MESSAGE_ID=None,
5757
return sendv(*args)
5858

5959
def stream(identifier, priority=LOG_DEBUG, level_prefix=False):
60-
r"""Return a file object wrapping a stream to journald.
60+
r"""Return a file object wrapping a stream to journal.
6161
6262
Log messages written to this file as simple newline sepearted
6363
text strings are written to the journal.
6464
6565
The file will be line buffered, so messages are actually sent
6666
after a newline character is written.
6767
68-
>>> stream = journald.stream('myapp')
68+
>>> stream = journal.stream('myapp')
6969
>>> stream
7070
<open file '<fdopen>', mode 'w' at 0x...>
7171
>>> stream.write('message...\n')

0 commit comments

Comments
 (0)