summaryrefslogtreecommitdiff
path: root/src/python-systemd/daemon.py
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-07-08 09:38:38 -0400
committerDaniel Mack <github@zonque.org>2015-07-08 09:38:38 -0400
commitb9fd7bb60a81849989c2102e46ee97e79b899328 (patch)
tree25393ad57584aa7e12d15850ed114a31e391fda3 /src/python-systemd/daemon.py
parent9a50ce20ef60263a6c88c29470ce761fcc424f2d (diff)
parent2799e519cabb6dfa99341b9a56ebd4dc2a4ec22a (diff)
Merge pull request #501 from keszybz/remove-python-systemd
Remove python-systemd
Diffstat (limited to 'src/python-systemd/daemon.py')
-rw-r--r--src/python-systemd/daemon.py55
1 files changed, 0 insertions, 55 deletions
diff --git a/src/python-systemd/daemon.py b/src/python-systemd/daemon.py
deleted file mode 100644
index 82011ca606..0000000000
--- a/src/python-systemd/daemon.py
+++ /dev/null
@@ -1,55 +0,0 @@
-from ._daemon import (__version__,
- booted,
- notify,
- _listen_fds,
- _is_fifo,
- _is_socket,
- _is_socket_inet,
- _is_socket_unix,
- _is_mq,
- LISTEN_FDS_START)
-from socket import AF_UNSPEC as _AF_UNSPEC
-
-def _convert_fileobj(fileobj):
- try:
- return fileobj.fileno()
- except AttributeError:
- return fileobj
-
-def is_fifo(fileobj, path=None):
- fd = _convert_fileobj(fileobj)
- return _is_fifo(fd, path)
-
-def is_socket(fileobj, family=_AF_UNSPEC, type=0, listening=-1):
- fd = _convert_fileobj(fileobj)
- return _is_socket(fd, family, type, listening)
-
-def is_socket_inet(fileobj, family=_AF_UNSPEC, type=0, listening=-1, port=0):
- fd = _convert_fileobj(fileobj)
- return _is_socket_inet(fd, family, type, listening, port)
-
-def is_socket_unix(fileobj, type=0, listening=-1, path=None):
- fd = _convert_fileobj(fileobj)
- return _is_socket_unix(fd, type, listening, path)
-
-def is_mq(fileobj, path=None):
- fd = _convert_fileobj(fileobj)
- return _is_mq(fd, path)
-
-def listen_fds(unset_environment=True):
- """Return a list of socket activated descriptors
-
- Example::
-
- (in primary window)
- $ systemd-activate -l 2000 python3 -c \\
- 'from systemd.daemon import listen_fds; print(listen_fds())'
- (in another window)
- $ telnet localhost 2000
- (in primary window)
- ...
- Execing python3 (...)
- [3]
- """
- num = _listen_fds(unset_environment)
- return list(range(LISTEN_FDS_START, LISTEN_FDS_START + num))