p3lib 1.1.123__py2.py3-none-any.whl → 1.1.124__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
@@ -9,7 +9,6 @@ import platform
|
|
9
9
|
import json
|
10
10
|
import traceback
|
11
11
|
import socket
|
12
|
-
import inspect
|
13
12
|
|
14
13
|
def initArgs(parser, lastCmdLineArg=None, checkHostArg=True):
|
15
14
|
"""This method is responsible for
|
@@ -389,8 +388,7 @@ def getAbsFile(filename):
|
|
389
388
|
@param filename The name of the icon file.
|
390
389
|
@return The abs path of the file or None if not found."""
|
391
390
|
file_found = None
|
392
|
-
|
393
|
-
abs_filename = os.path.join(startup_path, filename)
|
391
|
+
abs_filename = os.path.abspath(filename)
|
394
392
|
if os.path.isfile(abs_filename):
|
395
393
|
file_found = abs_filename
|
396
394
|
|
@@ -412,18 +410,18 @@ def getAbsFile(filename):
|
|
412
410
|
else:
|
413
411
|
# Try all the site packages folders we know about.
|
414
412
|
for path in sys.path:
|
415
|
-
if
|
416
|
-
|
417
|
-
abs_filename = os.path.join(site_packages_path, filename)
|
413
|
+
if os.path.isdir(path):
|
414
|
+
abs_filename = os.path.join(path, filename)
|
418
415
|
if os.path.isfile(abs_filename):
|
419
416
|
file_found = abs_filename
|
420
|
-
|
421
417
|
else:
|
422
|
-
|
423
|
-
abs_filename = os.path.join(
|
418
|
+
path2 = os.path.join(path, 'assets')
|
419
|
+
abs_filename = os.path.join(path2, filename)
|
424
420
|
if os.path.isfile(abs_filename):
|
425
421
|
file_found = abs_filename
|
426
422
|
break
|
423
|
+
if file_found:
|
424
|
+
break
|
427
425
|
|
428
426
|
return file_found
|
429
427
|
|
@@ -433,84 +431,23 @@ def getProgramVersion():
|
|
433
431
|
"""@return The program/package version. This comes from the pyproject.toml file.
|
434
432
|
If this file is not found an exception is thrown. """
|
435
433
|
poetryConfigFile = getAbsFile(PYPROJECT_FILE)
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
line
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
434
|
+
if poetryConfigFile:
|
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
|
+
else:
|
448
|
+
# In the event we can't find the PYPROJECT_FILE file return an invalid verion (hopefully)
|
449
|
+
# to indicate this. This can happen if the pyproject.toml file is not included or can't be
|
450
|
+
# found.
|
451
|
+
return -999.99
|
448
452
|
return programVersion
|
449
453
|
|
450
|
-
def get_assets_folders():
|
451
|
-
"""@return A list of all the assets folders found."""
|
452
|
-
searchFolders = []
|
453
|
-
assetsFolders = []
|
454
|
-
calling_file = None
|
455
|
-
# Get the full path to the python file that called this get_assets_folders() function.
|
456
|
-
frame = inspect.stack()[1]
|
457
|
-
module = inspect.getmodule(frame[0])
|
458
|
-
if module and hasattr(module, '__file__'):
|
459
|
-
calling_file = os.path.abspath(module.__file__)
|
460
|
-
|
461
|
-
if calling_file:
|
462
|
-
startup_path = os.path.dirname(calling_file)
|
463
|
-
searchFolders.append( os.path.join(startup_path, 'assets') )
|
464
|
-
pp1 = os.path.join(startup_path, '..')
|
465
|
-
searchFolders.append( os.path.join(pp1, 'assets') )
|
466
|
-
pp2 = os.path.join(pp1, '..')
|
467
|
-
searchFolders.append( os.path.join(pp2, 'assets') )
|
468
|
-
# Try all the site packages folders we know about.
|
469
|
-
for path in sys.path:
|
470
|
-
if 'site-packages' in path:
|
471
|
-
site_packages_path = path
|
472
|
-
searchFolders.append( os.path.join(site_packages_path, 'assets') )
|
473
|
-
|
474
|
-
for folder in searchFolders:
|
475
|
-
absPath = os.path.abspath(folder)
|
476
|
-
if os.path.isdir(absPath):
|
477
|
-
assetsFolders.append(absPath)
|
478
|
-
|
479
|
-
return assetsFolders
|
480
|
-
|
481
|
-
|
482
|
-
def get_assets_folder(raise_error=True):
|
483
|
-
"""@brief Get the assests folder.
|
484
|
-
@param raise_error If True then raise an error if the assets folder is not found.
|
485
|
-
@return The abs assets folder path string."""
|
486
|
-
searchFolders = []
|
487
|
-
assetsFolder = None
|
488
|
-
calling_file = None
|
489
|
-
# Get the full path to the python file that called this get_assets_folder() function.
|
490
|
-
frame = inspect.stack()[1]
|
491
|
-
module = inspect.getmodule(frame[0])
|
492
|
-
if module and hasattr(module, '__file__'):
|
493
|
-
calling_file = os.path.abspath(module.__file__)
|
494
|
-
|
495
|
-
if calling_file:
|
496
|
-
startup_path = os.path.dirname(calling_file)
|
497
|
-
searchFolders.append( os.path.join(startup_path, 'assets') )
|
498
|
-
pp1 = os.path.join(startup_path, '..')
|
499
|
-
searchFolders.append( os.path.join(pp1, 'assets') )
|
500
|
-
pp2 = os.path.join(pp1, '..')
|
501
|
-
searchFolders.append( os.path.join(pp2, 'assets') )
|
502
|
-
# Try all the site packages folders we know about.
|
503
|
-
for path in sys.path:
|
504
|
-
if 'site-packages' in path:
|
505
|
-
site_packages_path = path
|
506
|
-
searchFolders.append( os.path.join(site_packages_path, 'assets') )
|
507
|
-
|
508
|
-
for folder in searchFolders:
|
509
|
-
absPath = os.path.abspath(folder)
|
510
|
-
if os.path.isdir(absPath):
|
511
|
-
assetsFolder = absPath
|
512
|
-
|
513
|
-
if raise_error and assetsFolder is None:
|
514
|
-
raise Exception('Failed to find assets folder.')
|
515
|
-
|
516
|
-
return assetsFolder
|
@@ -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=
|
10
|
+
p3lib/helper.py,sha256=coGT0jv_hzfZJ46GLcADtdh5uhPtH8pxqIFVIG-nux4,15120
|
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.
|
23
|
-
p3lib-1.1.
|
24
|
-
p3lib-1.1.
|
25
|
-
p3lib-1.1.
|
22
|
+
p3lib-1.1.124.dist-info/LICENSE,sha256=igqTy5u0kVWM1n-NUZMvAlinY6lVjAXKoag0okkS8V8,1067
|
23
|
+
p3lib-1.1.124.dist-info/METADATA,sha256=Knk8TeQt5pqrzj9MMy4gZuaAedNsWBxZ29Mrwn01yhg,1382
|
24
|
+
p3lib-1.1.124.dist-info/WHEEL,sha256=5druYqcII7zHXzX7qmN0TH895Jg3yuTtfjMgJIVBrKE,92
|
25
|
+
p3lib-1.1.124.dist-info/RECORD,,
|
File without changes
|
File without changes
|