libbot 52__tar.gz → 53__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. {libbot-52 → libbot-53}/PKG-INFO +5 -4
  2. {libbot-52 → libbot-53}/README.rst +4 -3
  3. {libbot-52 → libbot-53}/bin/bot +3 -5
  4. libbot-53/bin/botd +68 -0
  5. {libbot-52 → libbot-53}/bot/modules/irc.py +1 -1
  6. {libbot-52 → libbot-53}/libbot.egg-info/PKG-INFO +5 -4
  7. {libbot-52 → libbot-53}/libbot.egg-info/SOURCES.txt +1 -0
  8. {libbot-52 → libbot-53}/pyproject.toml +3 -2
  9. {libbot-52 → libbot-53}/bot/__init__.py +0 -0
  10. {libbot-52 → libbot-53}/bot/disk.py +0 -0
  11. {libbot-52 → libbot-53}/bot/error.py +0 -0
  12. {libbot-52 → libbot-53}/bot/modules/__init__.py +0 -0
  13. {libbot-52 → libbot-53}/bot/modules/cmd.py +0 -0
  14. {libbot-52 → libbot-53}/bot/modules/err.py +0 -0
  15. {libbot-52 → libbot-53}/bot/modules/fnd.py +0 -0
  16. {libbot-52 → libbot-53}/bot/modules/log.py +0 -0
  17. {libbot-52 → libbot-53}/bot/modules/mbx.py +0 -0
  18. {libbot-52 → libbot-53}/bot/modules/mod.py +0 -0
  19. {libbot-52 → libbot-53}/bot/modules/rss.py +0 -0
  20. {libbot-52 → libbot-53}/bot/modules/shp.py +0 -0
  21. {libbot-52 → libbot-53}/bot/modules/tdo.py +0 -0
  22. {libbot-52 → libbot-53}/bot/modules/thr.py +0 -0
  23. {libbot-52 → libbot-53}/bot/modules/udp.py +0 -0
  24. {libbot-52 → libbot-53}/bot/object.py +0 -0
  25. {libbot-52 → libbot-53}/bot/parse.py +0 -0
  26. {libbot-52 → libbot-53}/bot/run.py +0 -0
  27. {libbot-52 → libbot-53}/bot/thread.py +0 -0
  28. {libbot-52 → libbot-53}/libbot.egg-info/dependency_links.txt +0 -0
  29. {libbot-52 → libbot-53}/libbot.egg-info/top_level.txt +0 -0
  30. {libbot-52 → libbot-53}/libbot.egg-info/zip-safe +0 -0
  31. {libbot-52 → libbot-53}/setup.cfg +0 -0
  32. {libbot-52 → libbot-53}/setup.py +0 -0
  33. {libbot-52 → libbot-53}/test/test_none.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: libbot
3
- Version: 52
3
+ Version: 53
4
4
  Summary: the python3 bot namespace
5
5
  Author-email: libbot <libbotx@gmail.com>
6
6
  License: Public Domain
@@ -160,7 +160,7 @@ here is a list of the most basic commands::
160
160
  SYSTEMD
161
161
  =======
162
162
 
163
- save the following it in /etc/systems/system/libbot.service and
163
+ save the following it in /etc/systems/system/botd.service and
164
164
  replace "<user>" with the user running pipx::
165
165
 
166
166
  [Unit]
@@ -173,7 +173,7 @@ replace "<user>" with the user running pipx::
173
173
  User=<user>
174
174
  Group=<user>
175
175
  WorkingDirectory=/home/<user>/.bot
176
- ExecStart=/home/<user>/.local/pipx/venvs/libbot/bin/bot -d
176
+ ExecStart=/home/<user>/.local/pipx/venvs/libbot/bin/botd
177
177
  RemainAfterExit=yes
178
178
 
179
179
  [Install]
@@ -181,7 +181,7 @@ replace "<user>" with the user running pipx::
181
181
 
182
182
  then run this::
183
183
 
184
- sudo systemctl enable libbot --now
184
+ sudo systemctl enable botd --now
185
185
 
186
186
 
187
187
  FILES
@@ -191,6 +191,7 @@ FILES
191
191
 
192
192
  ~/.bot
193
193
  ~/.local/bin/bot
194
+ ~/.local/bin/botd
194
195
  ~/.local/pipx/venvs/libbot/
195
196
 
196
197
 
@@ -144,7 +144,7 @@ here is a list of the most basic commands::
144
144
  SYSTEMD
145
145
  =======
146
146
 
147
- save the following it in /etc/systems/system/libbot.service and
147
+ save the following it in /etc/systems/system/botd.service and
148
148
  replace "<user>" with the user running pipx::
149
149
 
150
150
  [Unit]
@@ -157,7 +157,7 @@ replace "<user>" with the user running pipx::
157
157
  User=<user>
158
158
  Group=<user>
159
159
  WorkingDirectory=/home/<user>/.bot
160
- ExecStart=/home/<user>/.local/pipx/venvs/libbot/bin/bot -d
160
+ ExecStart=/home/<user>/.local/pipx/venvs/libbot/bin/botd
161
161
  RemainAfterExit=yes
162
162
 
163
163
  [Install]
@@ -165,7 +165,7 @@ replace "<user>" with the user running pipx::
165
165
 
166
166
  then run this::
167
167
 
168
- sudo systemctl enable libbot --now
168
+ sudo systemctl enable botd --now
169
169
 
170
170
 
171
171
  FILES
@@ -175,6 +175,7 @@ FILES
175
175
 
176
176
  ~/.bot
177
177
  ~/.local/bin/bot
178
+ ~/.local/bin/botd
178
179
  ~/.local/pipx/venvs/libbot/
179
180
 
180
181
 
@@ -64,20 +64,18 @@ def main():
64
64
  if "v" in Cfg.opts:
65
65
  dte = time.ctime(time.time()).replace(" ", " ")
66
66
  print(f"{Cfg.name.upper()} started {Cfg.opts.upper()} started {dte}")
67
- if not Cfg.mod:
68
- Cfg.mod = ",".join((lsmod(modules.__path__[0])))
67
+ Cfg.mod = ",".join((lsmod(modules.__path__[0])))
69
68
  if 'c' in Cfg.opts:
70
- scan(modules, Cfg.mod, "x" not in Cfg.opts)
69
+ scan(modules, Cfg.mod, True)
71
70
  csl = Console()
72
71
  csl.start()
73
72
  forever()
74
- return
75
73
  scan(modules, Cfg.mod)
76
74
  cli = CLI()
77
75
  command(Cfg.otxt, cli)
76
+ Errors.show()
78
77
 
79
78
 
80
79
  if __name__ == "__main__":
81
80
  wrap(main)
82
- Errors.show()
83
81
 
libbot-53/bin/botd ADDED
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env python3
2
+ # This file is placed in the Public Domain.
3
+ #
4
+ # pylint: disable=C0115,C0116,C0209,C0413,W0201,R0903,W0212,W0105,W0613
5
+
6
+
7
+ "daemon"
8
+
9
+
10
+ import getpass
11
+ import os
12
+ import pwd
13
+ import sys
14
+
15
+
16
+ from bot import Default, Storage, modules, cdir, forever, lsmod, scan
17
+
18
+
19
+ Cfg = Default()
20
+ Cfg.mod = ",".join((lsmod(modules.__path__[0])))
21
+ Cfg.name = "bot"
22
+ Storage.wd = os.path.expanduser(f"~/.{Cfg.name}")
23
+ Cfg.pidfile = os.path.join(Storage.wd, f"{Cfg.name}.pid")
24
+ Cfg.user = getpass.getuser()
25
+
26
+
27
+ def daemon(pidfile, verbose=False):
28
+ pid = os.fork()
29
+ if pid != 0:
30
+ os._exit(0)
31
+ os.setsid()
32
+ pid2 = os.fork()
33
+ if pid2 != 0:
34
+ os._exit(0)
35
+ if not verbose:
36
+ with open('/dev/null', 'r', encoding="utf-8") as sis:
37
+ os.dup2(sis.fileno(), sys.stdin.fileno())
38
+ with open('/dev/null', 'a+', encoding="utf-8") as sos:
39
+ os.dup2(sos.fileno(), sys.stdout.fileno())
40
+ with open('/dev/null', 'a+', encoding="utf-8") as ses:
41
+ os.dup2(ses.fileno(), sys.stderr.fileno())
42
+ os.umask(0)
43
+ os.chdir("/")
44
+ if os.path.exists(pidfile):
45
+ os.unlink(pidfile)
46
+ cdir(os.path.dirname(pidfile))
47
+ with open(pidfile, "w", encoding="utf-8") as fds:
48
+ fds.write(str(os.getpid()))
49
+
50
+
51
+ def privileges(username):
52
+ pwnam = pwd.getpwnam(username)
53
+ os.setgid(pwnam.pw_gid)
54
+ os.setuid(pwnam.pw_uid)
55
+
56
+
57
+ def main():
58
+ if "v" in Cfg.opts:
59
+ dte = time.ctime(time.time()).replace(" ", " ")
60
+ print(f"{Cfg.name.upper()} started {dte} {Cfg.opts.upper()} {Cfg.mod.upper()}")
61
+ print(Cfg)
62
+ daemon(Cfg.pidfile, "v" in Cfg.opts)
63
+ privileges(Cfg.user)
64
+ scan(modules, Cfg.mod, True)
65
+ forever()
66
+
67
+
68
+ main()
@@ -26,7 +26,7 @@ from bot.run import Broker, Commands, Event, Reactor
26
26
  from bot.thread import launch
27
27
 
28
28
 
29
- NAME = sys.argv[0].rsplit(os.sep, maxsplit=1)[-1]
29
+ NAME = "bot"
30
30
 
31
31
 
32
32
  Censor.words = ["PING", "PONG", "PRIVMSG"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: libbot
3
- Version: 52
3
+ Version: 53
4
4
  Summary: the python3 bot namespace
5
5
  Author-email: libbot <libbotx@gmail.com>
6
6
  License: Public Domain
@@ -160,7 +160,7 @@ here is a list of the most basic commands::
160
160
  SYSTEMD
161
161
  =======
162
162
 
163
- save the following it in /etc/systems/system/libbot.service and
163
+ save the following it in /etc/systems/system/botd.service and
164
164
  replace "<user>" with the user running pipx::
165
165
 
166
166
  [Unit]
@@ -173,7 +173,7 @@ replace "<user>" with the user running pipx::
173
173
  User=<user>
174
174
  Group=<user>
175
175
  WorkingDirectory=/home/<user>/.bot
176
- ExecStart=/home/<user>/.local/pipx/venvs/libbot/bin/bot -d
176
+ ExecStart=/home/<user>/.local/pipx/venvs/libbot/bin/botd
177
177
  RemainAfterExit=yes
178
178
 
179
179
  [Install]
@@ -181,7 +181,7 @@ replace "<user>" with the user running pipx::
181
181
 
182
182
  then run this::
183
183
 
184
- sudo systemctl enable libbot --now
184
+ sudo systemctl enable botd --now
185
185
 
186
186
 
187
187
  FILES
@@ -191,6 +191,7 @@ FILES
191
191
 
192
192
  ~/.bot
193
193
  ~/.local/bin/bot
194
+ ~/.local/bin/botd
194
195
  ~/.local/pipx/venvs/libbot/
195
196
 
196
197
 
@@ -2,6 +2,7 @@ README.rst
2
2
  pyproject.toml
3
3
  setup.py
4
4
  bin/bot
5
+ bin/botd
5
6
  bot/__init__.py
6
7
  bot/disk.py
7
8
  bot/error.py
@@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
9
9
  [project]
10
10
  name = "libbot"
11
11
  description = "the python3 bot namespace"
12
- version = "52"
12
+ version = "53"
13
13
  authors = [
14
14
  {name = "libbot",email = "libbotx@gmail.com"},
15
15
  ]
@@ -37,7 +37,8 @@ packages = [
37
37
  ]
38
38
  zip-safe=true
39
39
  script-files = [
40
- "bin/bot",
40
+ 'bin/bot',
41
+ 'bin/botd'
41
42
  ]
42
43
 
43
44
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes