-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from stigok/release-0.1.0
Release 0.1.0
- Loading branch information
Showing
5 changed files
with
67 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.PHONY: build clean upload-test | ||
|
||
build: clean | ||
python3 setup.py sdist bdist_wheel | ||
|
||
clean: | ||
rm -rf build dist *.egg-info __pycache__ | ||
|
||
upload-test: | ||
python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,20 +3,26 @@ | |
Usage: | ||
``` | ||
notify = Notifier() | ||
import sd_notify | ||
notify = sd_notify.Notifier() | ||
if not notify.enabled(): | ||
raise Exception("Watchdog not enabled") | ||
# Then it's probably not running is systemd with watchdog enabled | ||
raise Exception("Watchdog not enabled") | ||
notify.status("Starting things up...") | ||
time.sleep(3) | ||
# Report a status message | ||
notify.status("Initialising my service...") | ||
time.sleep(3) | ||
notify.ready() # Init complete | ||
notify.status("Waiting for requests...") | ||
time.sleep(3) | ||
# Report that the program init is complete | ||
notify.ready() | ||
notify.status("Waiting for web requests...") | ||
time.sleep(3) | ||
notify.notify_error("Making the program quit with error!") | ||
# systemd will kill the program here | ||
time.sleep(3) | ||
# Report an error to the service manager | ||
notify.notify_error("An irrecoverable error occured!") | ||
# The service manager will probably kill the program here | ||
time.sleep(3) | ||
``` | ||
Author: [email protected] Dec 2019 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from setuptools import setup, find_packages | ||
|
||
def readme(): | ||
with open('README.md') as f: | ||
return f.read() | ||
|
||
setup( | ||
name="sd-notify", | ||
version="0.1.0", | ||
py_modules=["sd_notify"], | ||
author="stigok", | ||
author_email="[email protected]", | ||
description="Simple sd_notify client library for Python 3", | ||
long_description=readme(), | ||
long_description_content_type="text/markdown", | ||
keywords="sd-notify systemd python3 watchdog", | ||
url="http://github.com/stigok/sd-notify/", | ||
project_urls={ | ||
"Bug Tracker": "http://github.com/stigok/sd-notify/issues", | ||
"Documentation": "http://github.com/stigok/sd-notify/", | ||
"Source Code": "http://github.com/stigok/sd-notify/", | ||
}, | ||
classifiers=[ | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python :: 3 :: Only", | ||
], | ||
python_requires=">=3.5", | ||
) |