p3lib 1.1.123__py2.py3-none-any.whl → 1.1.125__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
@@ -389,8 +389,7 @@ def getAbsFile(filename):
389
389
  @param filename The name of the icon file.
390
390
  @return The abs path of the file or None if not found."""
391
391
  file_found = None
392
- startup_path = os.getenv("PWD", os.getcwd())
393
- abs_filename = os.path.join(startup_path, filename)
392
+ abs_filename = os.path.abspath(filename)
394
393
  if os.path.isfile(abs_filename):
395
394
  file_found = abs_filename
396
395
 
@@ -412,18 +411,18 @@ def getAbsFile(filename):
412
411
  else:
413
412
  # Try all the site packages folders we know about.
414
413
  for path in sys.path:
415
- if 'site-packages' in path:
416
- site_packages_path = path
417
- abs_filename = os.path.join(site_packages_path, filename)
414
+ if os.path.isdir(path):
415
+ abs_filename = os.path.join(path, filename)
418
416
  if os.path.isfile(abs_filename):
419
417
  file_found = abs_filename
420
-
421
418
  else:
422
- path3 = os.path.join(site_packages_path, 'assets')
423
- abs_filename = os.path.join(path3, filename)
419
+ path2 = os.path.join(path, 'assets')
420
+ abs_filename = os.path.join(path2, filename)
424
421
  if os.path.isfile(abs_filename):
425
422
  file_found = abs_filename
426
423
  break
424
+ if file_found:
425
+ break
427
426
 
428
427
  return file_found
429
428
 
@@ -433,18 +432,24 @@ def getProgramVersion():
433
432
  """@return The program/package version. This comes from the pyproject.toml file.
434
433
  If this file is not found an exception is thrown. """
435
434
  poetryConfigFile = getAbsFile(PYPROJECT_FILE)
436
- programVersion = None
437
- with open(poetryConfigFile, 'r') as fd:
438
- lines = fd.readlines()
439
- for line in lines:
440
- line=line.strip("\r\n")
441
- if line.startswith('version'):
442
- elems = line.split("=")
443
- if len(elems) == 2:
444
- programVersion = elems[1].strip('" ')
445
- break
446
- if programVersion is None:
447
- raise Exception(f"Failed to extract program version from '{line}' line of {poetryConfigFile} file.")
435
+ if poetryConfigFile:
436
+ programVersion = None
437
+ with open(poetryConfigFile, 'r') as fd:
438
+ lines = fd.readlines()
439
+ for line in lines:
440
+ line=line.strip("\r\n")
441
+ if line.startswith('version'):
442
+ elems = line.split("=")
443
+ if len(elems) == 2:
444
+ programVersion = elems[1].strip('" ')
445
+ break
446
+ if programVersion is None:
447
+ raise Exception(f"Failed to extract program version from '{line}' line of {poetryConfigFile} file.")
448
+ else:
449
+ # In the event we can't find the PYPROJECT_FILE file return an invalid verion (hopefully)
450
+ # to indicate this. This can happen if the pyproject.toml file is not included or can't be
451
+ # found.
452
+ return -999.99
448
453
  return programVersion
449
454
 
450
455
  def get_assets_folders():
@@ -478,9 +483,8 @@ def get_assets_folders():
478
483
 
479
484
  return assetsFolders
480
485
 
481
-
482
486
  def get_assets_folder(raise_error=True):
483
- """@brief Get the assests folder.
487
+ """@brief Get the assets folder.
484
488
  @param raise_error If True then raise an error if the assets folder is not found.
485
489
  @return The abs assets folder path string."""
486
490
  searchFolders = []
@@ -513,4 +517,4 @@ def get_assets_folder(raise_error=True):
513
517
  if raise_error and assetsFolder is None:
514
518
  raise Exception('Failed to find assets folder.')
515
519
 
516
- return assetsFolder
520
+ return assetsFolder
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: p3lib
3
- Version: 1.1.123
3
+ Version: 1.1.125
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
  License: MIT
6
6
  Author: Paul Austen
@@ -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=jkcC07kfEDbrWOxVu60x0vmYORSR0kyWWlcDmP_Sbf8,17563
10
+ p3lib/helper.py,sha256=8gczHkqkvxoTKC2srf3t8s_0Psuun0iEO9xD-GBCH1Y,17802
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
@@ -19,7 +19,7 @@ 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
21
  p3lib/windows_app.py,sha256=cSkGDIakamxylhOYk0BHjjUQwBBhOq7sij4a7xs9v44,3057
22
- p3lib-1.1.123.dist-info/LICENSE,sha256=igqTy5u0kVWM1n-NUZMvAlinY6lVjAXKoag0okkS8V8,1067
23
- p3lib-1.1.123.dist-info/METADATA,sha256=OtiYjBiAEoKURSc1KCzCHQ3we7q5nnabjvJXOeoxTug,1382
24
- p3lib-1.1.123.dist-info/WHEEL,sha256=5druYqcII7zHXzX7qmN0TH895Jg3yuTtfjMgJIVBrKE,92
25
- p3lib-1.1.123.dist-info/RECORD,,
22
+ p3lib-1.1.125.dist-info/LICENSE,sha256=igqTy5u0kVWM1n-NUZMvAlinY6lVjAXKoag0okkS8V8,1067
23
+ p3lib-1.1.125.dist-info/METADATA,sha256=a6edrYmOrde-6Z9Obu5tzDMF825w5tOUEM1kMC6PSoI,1382
24
+ p3lib-1.1.125.dist-info/WHEEL,sha256=5druYqcII7zHXzX7qmN0TH895Jg3yuTtfjMgJIVBrKE,92
25
+ p3lib-1.1.125.dist-info/RECORD,,