p3lib 1.1.109__py2.py3-none-any.whl → 1.1.111__py2.py3-none-any.whl

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/helper.py CHANGED
@@ -273,7 +273,7 @@ def getHomePath():
273
273
  if platform.system() == 'Linux' and os.geteuid() == 0:
274
274
  # Fix for os.environ["HOME"] returning /home/root sometimes.
275
275
  return '/root/'
276
-
276
+
277
277
  elif "HOME" in os.environ:
278
278
  return os.environ["HOME"]
279
279
 
@@ -383,7 +383,8 @@ def getAbsFile(filename):
383
383
  1 - The startup folder
384
384
  2 - An 'assets' folder in the startup folder
385
385
  3 - An 'assets' folder in the startup parent folder
386
- 3 - In an 'assets' folder in a python site-packages folder.
386
+ 4 - In a site-packages folder.
387
+ 5 - In an 'assets' folder in a python site-packages folder.
387
388
  @param filename The name of the icon file.
388
389
  @return The abs path of the file or None if not found."""
389
390
  file_found = None
@@ -411,10 +412,37 @@ def getAbsFile(filename):
411
412
  for path in sys.path:
412
413
  if 'site-packages' in path:
413
414
  site_packages_path = path
414
- path3 = os.path.join(site_packages_path, 'assets')
415
- abs_filename = os.path.join(path3, filename)
415
+ abs_filename = os.path.join(site_packages_path, filename)
416
+ print(f"PJA: abs_filename={abs_filename}, FOUND={os.path.isfile(abs_filename)}")
416
417
  if os.path.isfile(abs_filename):
417
418
  file_found = abs_filename
418
- break
419
419
 
420
- return file_found
420
+ else:
421
+ path3 = os.path.join(site_packages_path, 'assets')
422
+ abs_filename = os.path.join(path3, filename)
423
+ if os.path.isfile(abs_filename):
424
+ file_found = abs_filename
425
+ break
426
+
427
+ return file_found
428
+
429
+ PYPROJECT_FILE = "pyproject.toml"
430
+
431
+ def getProgramVersion():
432
+ """@return The program/package version. This comes from the pyproject.toml file.
433
+ If this file is not found an exception is thrown. """
434
+ poetryConfigFile = getAbsFile(PYPROJECT_FILE)
435
+ programVersion = None
436
+ with open(poetryConfigFile, 'r') as fd:
437
+ lines = fd.readlines()
438
+ for line in lines:
439
+ line=line.strip("\r\n")
440
+ if line.startswith('version'):
441
+ elems = line.split("=")
442
+ if len(elems) == 2:
443
+ programVersion = elems[1].strip('" ')
444
+ break
445
+ if programVersion is None:
446
+ raise Exception(f"Failed to extract program version from '{line}' line of {poetryConfigFile} file.")
447
+ return programVersion
448
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: p3lib
3
- Version: 1.1.109
3
+ Version: 1.1.111
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/test_equipment
6
6
  License: MIT
@@ -7,7 +7,7 @@ p3lib/conduit.py,sha256=jPkjdtyCx2I6SFqcEo8y2g7rgnZ-jNY7oCuYIETzT5Q,6046
7
7
  p3lib/database_if.py,sha256=XKu1w3zftGbj4Rh54wrWJnoCtqHkhCzJUPN2S70XIKg,11915
8
8
  p3lib/file_io.py,sha256=A7_GKYPlmjRjq6U1YuWhmB0OhLhNm6cWQfQX8qfgYTk,5041
9
9
  p3lib/gnome_desktop_app.py,sha256=zl9SKRBV8ipVg2faCs_gbAr8c42J1N_pntbFGG2BMiE,6694
10
- p3lib/helper.py,sha256=RHA0T1ckG3wLgTXgI_1mrtbzvMBaIwd8ow7x9orXUfA,13730
10
+ p3lib/helper.py,sha256=DYfGYC7hmaZZJVivgnOHQGln5tJshZfJEC0KRIda7QU,14923
11
11
  p3lib/json_networking.py,sha256=6u4s1SmypjTYPnSxHP712OgQ3ZJaxOqIkgHQ1J7Qews,9738
12
12
  p3lib/login.html,sha256=DADTJGuvWQ-LTO4X6SaFdqK7JMW03DAa3lRieGD0d6g,2748
13
13
  p3lib/mqtt_rpc.py,sha256=6LmFA1kR4HSJs9eWbOJORRHNY01L_lHWjvtE2fmY8P8,10511
@@ -18,7 +18,7 @@ p3lib/pconfig.py,sha256=k1WHvmHzOfmkSbP7CrFyT1iTwn5_UROQjk6gltdh7bk,37280
18
18
  p3lib/ssh.py,sha256=OyoAQ_h1L2RfkjTAChDrvLFfl4Fe_gBNdX5rvK-wKiw,42125
19
19
  p3lib/table_plot.py,sha256=RPncwVlGUkkx5Fw0dHQedXo0TSPlTi__VrJBDzaMsuI,32116
20
20
  p3lib/uio.py,sha256=Aaxc99XiE3d2f9vLjaN-bZsckoNxay5t0ujdK6PXGrw,23265
21
- p3lib-1.1.109.dist-info/LICENSE,sha256=igqTy5u0kVWM1n-NUZMvAlinY6lVjAXKoag0okkS8V8,1067
22
- p3lib-1.1.109.dist-info/METADATA,sha256=kOt7WY42n-MJAlJujZXyFJo9hkmBOe48SHKEgOU5p84,1337
23
- p3lib-1.1.109.dist-info/WHEEL,sha256=IrRNNNJ-uuL1ggO5qMvT1GGhQVdQU54d6ZpYqEZfEWo,92
24
- p3lib-1.1.109.dist-info/RECORD,,
21
+ p3lib-1.1.111.dist-info/LICENSE,sha256=igqTy5u0kVWM1n-NUZMvAlinY6lVjAXKoag0okkS8V8,1067
22
+ p3lib-1.1.111.dist-info/METADATA,sha256=gUrAZLEjCDJ4CkOeeIMmnE-iXlLW-07NaLYeL8ZwNFU,1337
23
+ p3lib-1.1.111.dist-info/WHEEL,sha256=IrRNNNJ-uuL1ggO5qMvT1GGhQVdQU54d6ZpYqEZfEWo,92
24
+ p3lib-1.1.111.dist-info/RECORD,,