File tree Expand file tree Collapse file tree 5 files changed +67
-16
lines changed Expand file tree Collapse file tree 5 files changed +67
-16
lines changed Original file line number Diff line number Diff line change
1
+ venv
Original file line number Diff line number Diff line change
1
+ .PHONY : build clean upload-test
2
+
3
+ build : clean
4
+ python3 setup.py sdist bdist_wheel
5
+
6
+ clean :
7
+ rm -rf build dist * .egg-info __pycache__
8
+
9
+ upload-test :
10
+ python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
Original file line number Diff line number Diff line change @@ -4,19 +4,25 @@ Simple sd_notify(3) client functionality implemented in Python 3.
4
4
5
5
Usage:
6
6
```
7
- notify = Notifier()
7
+ import sd_notify
8
+
9
+ notify = sd_notify.Notifier()
8
10
if not notify.enabled():
11
+ # Then it's probably not running is systemd with watchdog enabled
9
12
raise Exception("Watchdog not enabled")
10
13
11
- notify.status("Starting things up...")
14
+ # Report a status message
15
+ notify.status("Initialising my service...")
12
16
time.sleep(3)
13
17
14
- notify.ready() # Init complete
15
- notify.status("Waiting for requests...")
18
+ # Report that the program init is complete
19
+ notify.ready()
20
+ notify.status("Waiting for web requests...")
16
21
time.sleep(3)
17
22
18
- notify.notify_error("Making the program quit with error!")
19
- # systemd will kill the program here
23
+ # Report an error to the service manager
24
+ notify.notify_error("An irrecoverable error occured!")
25
+ # The service manager will probably kill the program here
20
26
time.sleep(3)
21
27
```
22
28
Original file line number Diff line number Diff line change 3
3
4
4
Usage:
5
5
```
6
- notify = Notifier()
6
+ import sd_notify
7
+
8
+ notify = sd_notify.Notifier()
7
9
if not notify.enabled():
8
- raise Exception("Watchdog not enabled")
10
+ # Then it's probably not running is systemd with watchdog enabled
11
+ raise Exception("Watchdog not enabled")
9
12
10
- notify.status("Starting things up...")
11
- time.sleep(3)
13
+ # Report a status message
14
+ notify.status("Initialising my service...")
15
+ time.sleep(3)
12
16
13
- notify.ready() # Init complete
14
- notify.status("Waiting for requests...")
15
- time.sleep(3)
17
+ # Report that the program init is complete
18
+ notify.ready()
19
+ notify.status("Waiting for web requests...")
20
+ time.sleep(3)
16
21
17
- notify.notify_error("Making the program quit with error!")
18
- # systemd will kill the program here
19
- time.sleep(3)
22
+ # Report an error to the service manager
23
+ notify.notify_error("An irrecoverable error occured!")
24
+ # The service manager will probably kill the program here
25
+ time.sleep(3)
20
26
```
21
27
22
28
Author: stig@stigok.com Dec 2019
Original file line number Diff line number Diff line change
1
+ from setuptools import setup , find_packages
2
+
3
+ def readme ():
4
+ with open ('README.md' ) as f :
5
+ return f .read ()
6
+
7
+ setup (
8
+ name = "sd-notify" ,
9
+ version = "0.1.0" ,
10
+ py_modules = ["sd_notify" ],
11
+ author = "stigok" ,
12
+ author_email = "stig@stigok.com" ,
13
+ description = "Simple sd_notify client library for Python 3" ,
14
+ long_description = readme (),
15
+ long_description_content_type = "text/markdown" ,
16
+ keywords = "sd-notify systemd python3 watchdog" ,
17
+ url = "http://github.com/stigok/sd-notify/" ,
18
+ project_urls = {
19
+ "Bug Tracker" : "http://github.com/stigok/sd-notify/issues" ,
20
+ "Documentation" : "http://github.com/stigok/sd-notify/" ,
21
+ "Source Code" : "http://github.com/stigok/sd-notify/" ,
22
+ },
23
+ classifiers = [
24
+ "License :: OSI Approved :: MIT License" ,
25
+ "Programming Language :: Python :: 3 :: Only" ,
26
+ ],
27
+ python_requires = ">=3.5" ,
28
+ )
You can’t perform that action at this time.
0 commit comments