p3lib 1.1.80__tar.gz → 1.1.81__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 (31) hide show
  1. {p3lib-1.1.80 → p3lib-1.1.81}/PKG-INFO +1 -1
  2. {p3lib-1.1.80 → p3lib-1.1.81}/setup.cfg +1 -1
  3. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib/pconfig.py +14 -16
  4. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib/uio.py +9 -6
  5. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib.egg-info/PKG-INFO +1 -1
  6. {p3lib-1.1.80 → p3lib-1.1.81}/LICENSE +0 -0
  7. {p3lib-1.1.80 → p3lib-1.1.81}/README.md +0 -0
  8. {p3lib-1.1.80 → p3lib-1.1.81}/pyproject.toml +0 -0
  9. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib/__init__.py +0 -0
  10. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib/ate.py +0 -0
  11. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib/bokeh_auth.py +0 -0
  12. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib/bokeh_gui.py +0 -0
  13. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib/boot_manager.py +0 -0
  14. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib/conduit.py +0 -0
  15. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib/database_if.py +0 -0
  16. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib/helper.py +0 -0
  17. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib/json_networking.py +0 -0
  18. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib/mqtt_rpc.py +0 -0
  19. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib/netif.py +0 -0
  20. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib/netplotly.py +0 -0
  21. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib/ngt.py +0 -0
  22. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib/ssh.py +0 -0
  23. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib/table_plot.py +0 -0
  24. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib.egg-info/SOURCES.txt +0 -0
  25. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib.egg-info/dependency_links.txt +0 -0
  26. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib.egg-info/requires.txt +0 -0
  27. {p3lib-1.1.80 → p3lib-1.1.81}/src/p3lib.egg-info/top_level.txt +0 -0
  28. {p3lib-1.1.80 → p3lib-1.1.81}/tests/test_conduit.py +0 -0
  29. {p3lib-1.1.80 → p3lib-1.1.81}/tests/test_json_networking.py +0 -0
  30. {p3lib-1.1.80 → p3lib-1.1.81}/tests/test_netif.py +0 -0
  31. {p3lib-1.1.80 → p3lib-1.1.81}/tests/test_ssh.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: p3lib
3
- Version: 1.1.80
3
+ Version: 1.1.81
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.80
3
+ version = 1.1.81
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.
@@ -1,4 +1,4 @@
1
- #!/bin/sh/env python3d
1
+ #!/bin/sh/env python3
2
2
 
3
3
  import os
4
4
  import base64
@@ -6,6 +6,7 @@ import datetime
6
6
  import sys
7
7
  import json
8
8
  import copy
9
+ import platform
9
10
 
10
11
  from shutil import copyfile
11
12
 
@@ -313,31 +314,28 @@ class ConfigManager(object):
313
314
  if not cfgFilename:
314
315
  raise Exception("No config filename defined.")
315
316
 
316
- cfgFilename = cfgFilename
317
317
  if addDotToFilename:
318
318
  if not cfgFilename.startswith("."):
319
319
 
320
320
  cfgFilename=".%s" % (cfgFilename)
321
321
 
322
- else:
323
-
324
- cfgFilename=cfgFilename
325
-
326
322
  #The the config path has been set then use it
327
323
  if cfgPath:
328
324
  configPath = cfgPath
329
325
 
330
326
  else:
331
- configPath=""
332
- #If an absolute path is set for the config file then don't try to
333
- #put the file in the users home dir
334
- if not cfgFilename.startswith("/"):
335
- configPath = expanduser("~")
336
- configPath = configPath.strip()
337
- #If no user is known then default to root user.
338
- #This occurs on Omega2 startup apps.
339
- if len(configPath) == 0 or configPath == '/' or configPath == '/root':
340
- configPath="/root"
327
+ # If the root user on a Linux system
328
+ if platform.system() == 'Linux' and os.geteuid() == 0:
329
+ # This should be the root users config folder.
330
+ configPath="/root"
331
+
332
+ else:
333
+ configPath=""
334
+ #If an absolute path is set for the config file then don't try to
335
+ #put the file in the users home dir
336
+ if not cfgFilename.startswith("/"):
337
+ configPath = expanduser("~")
338
+ configPath = configPath.strip()
341
339
 
342
340
  return join( configPath, cfgFilename )
343
341
 
@@ -113,7 +113,7 @@ class UIO(object):
113
113
  self._print('{}INFO{}: {}'.format(UIO.GetInfoEscapeSeq(), UIO.DISPLAY_RESET_ESCAPE_SEQ, text))
114
114
  else:
115
115
  self._print('INFO: {}'.format(text))
116
- self._update_syslog(PRIORITY.INFO, text)
116
+ self._update_syslog(PRIORITY.INFO, "INFO: "+text)
117
117
 
118
118
  def debug(self, text):
119
119
  """@brief Present a debug level message to the user if debuging is enabled.
@@ -128,7 +128,7 @@ class UIO(object):
128
128
  self.storeToDebugLog('{}DEBUG{}: {}'.format(UIO.GetDebugEscapeSeq(), UIO.DISPLAY_RESET_ESCAPE_SEQ, text))
129
129
  else:
130
130
  self.storeToDebugLog('DEBUG: {}'.format(text))
131
- self._update_syslog(PRIORITY.DEBUG, text)
131
+ self._update_syslog(PRIORITY.DEBUG, "DEBUG: "+text)
132
132
 
133
133
  def warn(self, text):
134
134
  """@brief Present a warning level message to the user.
@@ -137,7 +137,7 @@ class UIO(object):
137
137
  self._print('{}WARN{}: {}'.format(UIO.GetWarnEscapeSeq(), UIO.DISPLAY_RESET_ESCAPE_SEQ, text))
138
138
  else:
139
139
  self._print('WARN: {}'.format(text))
140
- self._update_syslog(PRIORITY.WARNING, text)
140
+ self._update_syslog(PRIORITY.WARNING, "WARN: "+text)
141
141
 
142
142
  def error(self, text):
143
143
  """@brief Present an error level message to the user.
@@ -146,7 +146,7 @@ class UIO(object):
146
146
  self._print('{}ERROR{}: {}'.format(UIO.GetErrorEscapeSeq(), UIO.DISPLAY_RESET_ESCAPE_SEQ, text))
147
147
  else:
148
148
  self._print('ERROR: {}'.format(text))
149
- self._update_syslog(PRIORITY.ERROR, text)
149
+ self._update_syslog(PRIORITY.ERROR, "ERROR: "+text)
150
150
 
151
151
  def _print(self, text):
152
152
  """@brief Print text to stdout"""
@@ -382,7 +382,10 @@ class UIO(object):
382
382
  @param syslogProgramName The name of the program that is being logged. If defined this appears after the username in the syslog output."""
383
383
  self._sysLogEnabled = enabled
384
384
  self._sysLogHost = host
385
- self._syslogProgramName = programName
385
+ if programName:
386
+ self._syslogProgramName = programName
387
+ else:
388
+ self._syslogProgramName = sys.argv[0]
386
389
 
387
390
  def _update_syslog(self, pri, msg):
388
391
  """Send a message to syslog is syslog is enabled
@@ -398,7 +401,7 @@ class UIO(object):
398
401
  """
399
402
  if self._sysLogEnabled:
400
403
  aMsg=msg
401
- #Ensure we have no zero characters in the message.
404
+ #Ensure we have no 0x00 characters in the message.
402
405
  # syslog will throw an error if it finds any
403
406
  if "\x00" in aMsg:
404
407
  aMsg=aMsg.replace("\x00", "")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: p3lib
3
- Version: 1.1.80
3
+ Version: 1.1.81
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