p3lib 1.1.93__tar.gz → 1.1.94__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.
- {p3lib-1.1.93 → p3lib-1.1.94}/PKG-INFO +1 -1
- {p3lib-1.1.93 → p3lib-1.1.94}/setup.cfg +1 -1
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib/boot_manager.py +31 -17
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib/helper.py +0 -1
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib.egg-info/PKG-INFO +1 -1
- {p3lib-1.1.93 → p3lib-1.1.94}/LICENSE +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/README.md +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/pyproject.toml +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib/__init__.py +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib/ate.py +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib/bokeh_auth.py +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib/bokeh_gui.py +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib/conduit.py +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib/database_if.py +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib/json_networking.py +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib/mqtt_rpc.py +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib/netif.py +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib/netplotly.py +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib/ngt.py +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib/pconfig.py +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib/ssh.py +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib/table_plot.py +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib/uio.py +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib.egg-info/SOURCES.txt +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib.egg-info/dependency_links.txt +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib.egg-info/requires.txt +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/src/p3lib.egg-info/top_level.txt +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/tests/test_conduit.py +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/tests/test_json_networking.py +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/tests/test_netif.py +0 -0
- {p3lib-1.1.93 → p3lib-1.1.94}/tests/test_ssh.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: p3lib
|
3
|
-
Version: 1.1.
|
3
|
+
Version: 1.1.94
|
4
4
|
Summary: A group of python modules for networking, plotting data, config storage, automating boot scripts, ssh access and user input output.
|
5
5
|
Home-page: https://github.com/pjaos/p3lib
|
6
6
|
Author: Paul Austen
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[metadata]
|
2
2
|
name = p3lib
|
3
|
-
version = 1.1.
|
3
|
+
version = 1.1.94
|
4
4
|
author = Paul Austen
|
5
5
|
author_email = pausten.os@gmail.com
|
6
6
|
description = A group of python modules for networking, plotting data, config storage, automating boot scripts, ssh access and user input output.
|
@@ -72,7 +72,7 @@ class BootManager(object):
|
|
72
72
|
for line in lines:
|
73
73
|
uio.info(line)
|
74
74
|
|
75
|
-
def __init__(self, uio=None, allowRootUser=True, ensureRootUser=False):
|
75
|
+
def __init__(self, uio=None, allowRootUser=True, ensureRootUser=False, appName=None, restartSeconds=1):
|
76
76
|
"""@brief Constructor
|
77
77
|
@param uio A UIO instance to display user output. If unset then no output
|
78
78
|
is displayed to user.
|
@@ -81,13 +81,16 @@ class BootManager(object):
|
|
81
81
|
ensuring programs are started up when a machine boots up
|
82
82
|
the installed program should be installed for the root
|
83
83
|
user on Linux systems.
|
84
|
-
@param ensureRootUser If True the current user must be root user (Linux systems).
|
84
|
+
@param ensureRootUser If True the current user must be root user (Linux systems).
|
85
|
+
@param appName The name of the app. This is used as the service name. If not set then
|
86
|
+
the name of the initially executed python file is used.
|
87
|
+
@param restartSeconds The number of seconds to sleep before restarting a service that has stopped (default=1)."""
|
85
88
|
self._uio = uio
|
86
89
|
self._allowRootUser=allowRootUser
|
87
90
|
self._osName = platform.system()
|
88
91
|
self._platformBootManager = None
|
89
92
|
if self._osName == BootManager.LINUX_OS_NAME:
|
90
|
-
self._platformBootManager = LinuxBootManager(uio, self._allowRootUser, ensureRootUser)
|
93
|
+
self._platformBootManager = LinuxBootManager(uio, self._allowRootUser, ensureRootUser, appName, restartSeconds)
|
91
94
|
else:
|
92
95
|
raise Exception("{} is an unsupported OS.".format(self._osName) )
|
93
96
|
|
@@ -155,11 +158,14 @@ class LinuxBootManager(object):
|
|
155
158
|
raise Exception(f"{serviceFolder} folder not found.")
|
156
159
|
return serviceFolder
|
157
160
|
|
158
|
-
def __init__(self, uio, allowRootUser, ensureRootUser):
|
161
|
+
def __init__(self, uio, allowRootUser, ensureRootUser, appName, restartSeconds):
|
159
162
|
"""@brief Constructor
|
160
163
|
@param uio A UIO instance to display user output. If unset then no output is displayed to user.
|
161
164
|
@param allowRootUser If True then allow root user to to auto start programs.
|
162
|
-
@param ensureRootUser If True the current user must be root user.
|
165
|
+
@param ensureRootUser If True the current user must be root user.
|
166
|
+
@param appName The name of the app. This is used as the systemd service name. If not set then
|
167
|
+
the name of the initially executed python file is used.
|
168
|
+
@param restartSeconds The number of seconds to sleep before restarting a service that has stopped."""
|
163
169
|
self._uio = uio
|
164
170
|
self._logFile = None
|
165
171
|
self._allowRootUser=allowRootUser
|
@@ -180,7 +186,8 @@ class LinuxBootManager(object):
|
|
180
186
|
self._cmdLinePrefix = self._systemCtlBin
|
181
187
|
self._username = getpass.getuser()
|
182
188
|
self._serviceFolder = LinuxBootManager.GetServiceFolder(self._rootMode)
|
183
|
-
self._appName =
|
189
|
+
self._appName = appName
|
190
|
+
self._restartSeconds = restartSeconds
|
184
191
|
|
185
192
|
def _getInstallledStartupScript(self):
|
186
193
|
"""@brief Get the startup script full path. The startup script must be
|
@@ -252,18 +259,25 @@ class LinuxBootManager(object):
|
|
252
259
|
if not os.path.isdir(exePath):
|
253
260
|
self._fatalError("{} path not found".format(exePath))
|
254
261
|
|
255
|
-
appName
|
256
|
-
if
|
257
|
-
|
262
|
+
# If the appName was set in the constructor then use this.
|
263
|
+
if self._appName:
|
264
|
+
appName = self._appName
|
258
265
|
|
259
|
-
|
260
|
-
|
261
|
-
self._fatalError("{} file not found.".format(absApp) )
|
266
|
+
# Else we use the initially executed python file.
|
267
|
+
else:
|
262
268
|
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
269
|
+
appName = os.path.basename(exeFile)
|
270
|
+
if len(appName) == 0:
|
271
|
+
self._fatalError("No app found to execute.")
|
272
|
+
|
273
|
+
absApp = os.path.join(exePath, appName)
|
274
|
+
if not os.path.isfile( absApp ):
|
275
|
+
self._fatalError("{} file not found.".format(absApp) )
|
276
|
+
|
277
|
+
appName = appName.replace(".py", "")
|
278
|
+
if self._rootMode:
|
279
|
+
# We can only save to /var/log/ is we are root user.
|
280
|
+
self._logFile = os.path.join(LinuxBootManager.LOG_PATH, appName)
|
267
281
|
|
268
282
|
return (appName, absApp)
|
269
283
|
|
@@ -302,7 +316,7 @@ class LinuxBootManager(object):
|
|
302
316
|
lines.append("[Service]")
|
303
317
|
lines.append("Type=simple")
|
304
318
|
lines.append("Restart=always")
|
305
|
-
lines.append("RestartSec=
|
319
|
+
lines.append(f"RestartSec={self._restartSeconds}")
|
306
320
|
if enableSyslog:
|
307
321
|
lines.append("StandardOutput=syslog")
|
308
322
|
lines.append("StandardError=syslog")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: p3lib
|
3
|
-
Version: 1.1.
|
3
|
+
Version: 1.1.94
|
4
4
|
Summary: A group of python modules for networking, plotting data, config storage, automating boot scripts, ssh access and user input output.
|
5
5
|
Home-page: https://github.com/pjaos/p3lib
|
6
6
|
Author: Paul Austen
|
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
|
File without changes
|
File without changes
|