Skip to content

Commit 8b92ac5

Browse files
authored
Merge pull request #114 from keszybz/install-docs
Update/clean-up installation instructions
2 parents fe4450e + 65b1c19 commit 8b92ac5

File tree

1 file changed

+41
-31
lines changed

1 file changed

+41
-31
lines changed

README.md

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,57 @@ python-systemd
33

44
Python module for native access to the systemd facilities. Functionality
55
is separated into a number of modules:
6-
- systemd.journal supports sending of structured messages to the journal
6+
- `systemd.journal` supports sending of structured messages to the journal
77
and reading journal files,
8-
- systemd.daemon wraps parts of libsystemd useful for writing daemons
8+
- `systemd.daemon` wraps parts of `libsystemd` useful for writing daemons
99
and socket activation,
10-
- systemd.id128 provides functions for querying machine and boot identifiers
10+
- `systemd.id128` provides functions for querying machine and boot identifiers
1111
and a lists of message identifiers provided by systemd,
12-
- systemd.login wraps parts of libsystemd used to query logged in users
12+
- `systemd.login` wraps parts of `libsystemd` used to query logged in users
1313
and available seats and machines.
1414

1515
Installation
1616
============
1717

1818
This module should be packaged for almost all Linux distributions. Use
1919

20-
On Fedora/RHEL/CentOS
20+
On Fedora:
2121

22-
dnf install python-systemd python3-systemd
22+
dnf install python3-systemd
2323

24-
On Debian/Ubuntu/Mint
24+
On Debian/Ubuntu/Mint:
2525

26-
apt-get install python-systemd python3-systemd
26+
apt update
27+
apt install python3-systemd
2728

28-
On openSUSE and SLE
29+
On openSUSE and SLE:
2930

30-
zypper in python-systemd
31+
zypper in python3-systemd
32+
33+
On Arch:
34+
35+
pacman -Sy python-systemd
3136

3237
To build from source
3338
--------------------
3439

3540
On CentOS, RHEL, and Fedora with Python 2:
3641

3742
dnf install git python-pip gcc python-devel systemd-devel
38-
pip install git+https://github.com/systemd/python-systemd.git#egg=systemd
43+
pip install 'git+https://github.com/systemd/python-systemd.git#egg=systemd-python'
3944

4045
On Fedora with Python 3:
4146

4247
dnf install git python3-pip gcc python3-devel systemd-devel
43-
pip3 install git+https://github.com/systemd/python-systemd.git#egg=systemd
48+
pip3 install 'git+https://github.com/systemd/python-systemd.git#egg=systemd-python'
4449

4550
On Debian or Ubuntu with Python 2:
4651

47-
apt-get install libsystemd-{journal,daemon,login,id128}-dev gcc python-dev pkg-config
52+
apt install libsystemd-{journal,daemon,login,id128}-dev gcc python-dev pkg-config
4853

4954
On Debian or Ubuntu with Python 3:
5055

51-
apt-get install libsystemd-{journal,daemon,login,id128}-dev gcc python3-dev pkg-config
56+
apt install libsystemd-{journal,daemon,login,id128}-dev gcc python3-dev pkg-config
5257

5358
The project is also available on pypi as `systemd-python`.
5459

@@ -62,7 +67,7 @@ Quick example:
6267
journal.send('Hello, again, world', FIELD2='Greetings!', FIELD3='Guten tag')
6368
journal.send('Binary message', BINARY=b'\xde\xad\xbe\xef')
6469

65-
There is one required argument -- the message, and additional fields
70+
There is one required argument the message, and additional fields
6671
can be specified as keyword arguments. Following the journald API, all
6772
names are uppercase.
6873

@@ -119,7 +124,12 @@ Show entries by a specific executable (`journalctl /usr/bin/vim`):
119124
for entry in j:
120125
print(entry['MESSAGE'])
121126

122-
- Note: matches can be added from many different fields, for example entries from a specific process ID can be matched with the `_PID` field, and entries from a specific unit (ie. `journalctl -u systemd-udevd.service`) can be matched with `_SYSTEMD_UNIT`. See all fields available at the [systemd.journal-fields docs](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html).
127+
- Note: matches can be added from many different fields, for example
128+
entries from a specific process ID can be matched with the `_PID`
129+
field, and entries from a specific unit (ie. `journalctl -u
130+
systemd-udevd.service`) can be matched with `_SYSTEMD_UNIT`.
131+
See all fields available at the
132+
[systemd.journal-fields docs](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html).
123133

124134
Show kernel ring buffer (`journalctl -k`):
125135

@@ -149,13 +159,13 @@ Read entries in reverse (`journalctl _EXE=/usr/bin/vim -r`):
149159
Notes
150160
-----
151161

152-
* Unlike the native C version of journald's sd_journal_send(),
153-
printf-style substitution is not supported. Perform any
154-
substitution using Python's % operator or .format() capabilities
155-
first.
156-
* A ValueError is raised if sd_journald_sendv() results in an error.
157-
This might happen if there are no arguments or one of them is
158-
invalid.
162+
* Unlike the native C version of journald's `sd_journal_send()`,
163+
printf-style substitution is not supported. Perform any
164+
substitution using Python's f-strings first (or .format()
165+
capabilities or `%` operator).
166+
* A `ValueError` is raised if `sd_journald_sendv()` results in an
167+
error. This might happen if there are no arguments or one of them
168+
is invalid.
159169

160170
A handler class for the Python logging framework is also provided:
161171

@@ -165,16 +175,16 @@ A handler class for the Python logging framework is also provided:
165175
logger.addHandler(journal.JournalHandler(SYSLOG_IDENTIFIER='custom_unit_name'))
166176
logger.warning("Some message: %s", 'detail')
167177

168-
libsystemd version compatibility
169-
-------------------------------
178+
`libsystemd` version compatibility
179+
----------------------------------
170180

171-
This module may be compiled against any version of libsystemd. At
181+
This module may be compiled against any version of `libsystemd`. At
172182
compilation time, any functionality that is not available in that
173-
version of systemd is disabled, and the resulting binary module will
174-
depend on symbols that were available at compilation time. This means
175-
that the resulting binary module is compatible with that or any later
176-
version of libsystemd. To obtain maximum possible functionality, this
177-
module must be compile against suitably recent libsystemd.
183+
version is disabled, and the resulting binary module will depend on
184+
symbols that were available at compilation time. This means that the
185+
resulting binary module is compatible with that or any later version
186+
of `libsystemd`. To obtain maximum possible functionality, this module
187+
must be compile against suitably recent libsystemd.
178188

179189
Documentation
180190
=============

0 commit comments

Comments
 (0)