ScriptCollection 3.5.74__py3-none-any.whl → 3.5.76__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.
- ScriptCollection/GeneralUtilities.py +30 -1
- ScriptCollection/ScriptCollectionCore.py +18 -16
- {ScriptCollection-3.5.74.dist-info → ScriptCollection-3.5.76.dist-info}/METADATA +1 -1
- {ScriptCollection-3.5.74.dist-info → ScriptCollection-3.5.76.dist-info}/RECORD +7 -7
- {ScriptCollection-3.5.74.dist-info → ScriptCollection-3.5.76.dist-info}/WHEEL +0 -0
- {ScriptCollection-3.5.74.dist-info → ScriptCollection-3.5.76.dist-info}/entry_points.txt +0 -0
- {ScriptCollection-3.5.74.dist-info → ScriptCollection-3.5.76.dist-info}/top_level.txt +0 -0
|
@@ -862,6 +862,31 @@ class GeneralUtilities:
|
|
|
862
862
|
def current_system_is_linux():
|
|
863
863
|
return platform.system() == 'Linux'
|
|
864
864
|
|
|
865
|
+
@staticmethod
|
|
866
|
+
@check_arguments
|
|
867
|
+
def get_line():
|
|
868
|
+
return "--------------------------"
|
|
869
|
+
|
|
870
|
+
@staticmethod
|
|
871
|
+
def get_longline():
|
|
872
|
+
return GeneralUtilities.get_line() + GeneralUtilities.get_line()
|
|
873
|
+
|
|
874
|
+
@staticmethod
|
|
875
|
+
@check_arguments
|
|
876
|
+
def get_icon_check_empty(positive: bool) -> str:
|
|
877
|
+
if positive:
|
|
878
|
+
return "✅"
|
|
879
|
+
else:
|
|
880
|
+
return ""
|
|
881
|
+
|
|
882
|
+
@staticmethod
|
|
883
|
+
@check_arguments
|
|
884
|
+
def get_icon_check_cross(positive: bool) -> str:
|
|
885
|
+
if positive:
|
|
886
|
+
return "✅"
|
|
887
|
+
else:
|
|
888
|
+
return "❌"
|
|
889
|
+
|
|
865
890
|
@staticmethod
|
|
866
891
|
@check_arguments
|
|
867
892
|
def get_certificate_expiry_date(certificate_file: str) -> datetime:
|
|
@@ -925,7 +950,7 @@ class GeneralUtilities:
|
|
|
925
950
|
|
|
926
951
|
@staticmethod
|
|
927
952
|
@check_arguments
|
|
928
|
-
def retry_action(action, amount_of_attempts: int) -> None:
|
|
953
|
+
def retry_action(action, amount_of_attempts: int,action_name:str=None) -> None:
|
|
929
954
|
amount_of_fails = 0
|
|
930
955
|
enabled = True
|
|
931
956
|
while enabled:
|
|
@@ -936,6 +961,10 @@ class GeneralUtilities:
|
|
|
936
961
|
amount_of_fails = amount_of_fails+1
|
|
937
962
|
GeneralUtilities.assert_condition(not (amount_of_attempts < amount_of_fails))
|
|
938
963
|
if amount_of_fails == amount_of_attempts:
|
|
964
|
+
message=f"Action failed {amount_of_attempts} times."
|
|
965
|
+
if action_name is not None:
|
|
966
|
+
message=f"{message} Name of action: {action_name}"
|
|
967
|
+
GeneralUtilities.write_exception_to_stderr(message)
|
|
939
968
|
raise
|
|
940
969
|
return None
|
|
941
970
|
|
|
@@ -32,7 +32,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
|
|
|
32
32
|
from .ProgramRunnerPopen import ProgramRunnerPopen
|
|
33
33
|
from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
|
|
34
34
|
|
|
35
|
-
version = "3.5.
|
|
35
|
+
version = "3.5.76"
|
|
36
36
|
__version__ = version
|
|
37
37
|
|
|
38
38
|
|
|
@@ -1344,12 +1344,6 @@ class ScriptCollectionCore:
|
|
|
1344
1344
|
|
|
1345
1345
|
@GeneralUtilities.check_arguments
|
|
1346
1346
|
def __run_program_argsasarray_async_helper(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, verbosity: int = 1, print_errors_as_information: bool = False, log_file: str = None, timeoutInSeconds: int = 600, addLogOverhead: bool = False, title: str = None, log_namespace: str = "", arguments_for_log: list[str] = None, custom_argument: object = None, interactive: bool = False) -> Popen:
|
|
1347
|
-
# Verbosity:
|
|
1348
|
-
# 0=Quiet (No output will be printed.)
|
|
1349
|
-
# 1=Normal (If the exitcode of the executed program is not 0 then the StdErr will be printed.)
|
|
1350
|
-
# 2=Full (Prints StdOut and StdErr of the executed program.)
|
|
1351
|
-
# 3=Verbose (Same as "Full" but with some more information.)
|
|
1352
|
-
|
|
1353
1347
|
if isinstance(self.program_runner, ProgramRunnerEpew):
|
|
1354
1348
|
custom_argument = CustomEpewArgument(print_errors_as_information, log_file, timeoutInSeconds, addLogOverhead, title, log_namespace, verbosity, arguments_for_log)
|
|
1355
1349
|
popen: Popen = self.program_runner.run_program_argsasarray_async_helper(program, arguments_as_array, working_directory, custom_argument, interactive)
|
|
@@ -1378,7 +1372,7 @@ class ScriptCollectionCore:
|
|
|
1378
1372
|
return False
|
|
1379
1373
|
|
|
1380
1374
|
@staticmethod
|
|
1381
|
-
def __read_popen_pipes(p: Popen) -> tuple[list[str], list[str]]:
|
|
1375
|
+
def __read_popen_pipes(p: Popen,print_live_output:bool,print_errors_as_information:bool) -> tuple[list[str], list[str]]:
|
|
1382
1376
|
p_id = p.pid
|
|
1383
1377
|
with ThreadPoolExecutor(2) as pool:
|
|
1384
1378
|
q_stdout = Queue()
|
|
@@ -1393,18 +1387,30 @@ class ScriptCollectionCore:
|
|
|
1393
1387
|
stderr_result: list[str] = []
|
|
1394
1388
|
|
|
1395
1389
|
while (ScriptCollectionCore.__continue_process_reading(p_id, p, q_stdout, q_stderr, reading_stdout_last_time_resulted_in_exception, reading_stderr_last_time_resulted_in_exception)):
|
|
1396
|
-
|
|
1397
1390
|
try:
|
|
1398
1391
|
while not q_stdout.empty():
|
|
1399
|
-
|
|
1392
|
+
out_line:str=q_stdout.get_nowait()
|
|
1393
|
+
stdout_result.append(out_line)
|
|
1400
1394
|
reading_stdout_last_time_resulted_in_exception = False
|
|
1395
|
+
if print_live_output:
|
|
1396
|
+
print(out_line, end='\n', file=sys.stdout, flush=False)
|
|
1397
|
+
if print_live_output:
|
|
1398
|
+
sys.stdout.flush()
|
|
1401
1399
|
except Empty:
|
|
1402
1400
|
reading_stdout_last_time_resulted_in_exception = True
|
|
1403
1401
|
|
|
1404
1402
|
try:
|
|
1405
1403
|
while not q_stderr.empty():
|
|
1406
|
-
|
|
1404
|
+
err_line:str=q_stderr.get_nowait()
|
|
1405
|
+
stderr_result.append(err_line)
|
|
1407
1406
|
reading_stderr_last_time_resulted_in_exception = False
|
|
1407
|
+
if print_live_output:
|
|
1408
|
+
print(err_line, end='\n', file=sys.stdout if print_errors_as_information else sys.stderr, flush=False)
|
|
1409
|
+
if print_live_output:
|
|
1410
|
+
if print_errors_as_information:
|
|
1411
|
+
sys.stdout.flush()
|
|
1412
|
+
else:
|
|
1413
|
+
sys.stderr.flush()
|
|
1408
1414
|
except Empty:
|
|
1409
1415
|
reading_stderr_last_time_resulted_in_exception = True
|
|
1410
1416
|
|
|
@@ -1452,7 +1458,7 @@ class ScriptCollectionCore:
|
|
|
1452
1458
|
GeneralUtilities.ensure_file_exists(log_file)
|
|
1453
1459
|
pid = process.pid
|
|
1454
1460
|
|
|
1455
|
-
outputs: tuple[list[str], list[str]] = ScriptCollectionCore.__read_popen_pipes(process)
|
|
1461
|
+
outputs: tuple[list[str], list[str]] = ScriptCollectionCore.__read_popen_pipes(process,print_live_output,print_errors_as_information)
|
|
1456
1462
|
|
|
1457
1463
|
for out_line_plain in outputs[0]:
|
|
1458
1464
|
if out_line_plain is not None:
|
|
@@ -1467,8 +1473,6 @@ class ScriptCollectionCore:
|
|
|
1467
1473
|
if out_line is not None and GeneralUtilities.string_has_content(out_line):
|
|
1468
1474
|
if out_line.endswith("\n"):
|
|
1469
1475
|
out_line = out_line[:-1]
|
|
1470
|
-
if print_live_output:
|
|
1471
|
-
print(out_line, end='\n', file=sys.stdout, flush=True)
|
|
1472
1476
|
if 0 < len(stdout):
|
|
1473
1477
|
stdout = stdout+"\n"
|
|
1474
1478
|
stdout = stdout+out_line
|
|
@@ -1487,8 +1491,6 @@ class ScriptCollectionCore:
|
|
|
1487
1491
|
if err_line is not None and GeneralUtilities.string_has_content(err_line):
|
|
1488
1492
|
if err_line.endswith("\n"):
|
|
1489
1493
|
err_line = err_line[:-1]
|
|
1490
|
-
if print_live_output:
|
|
1491
|
-
print(err_line, end='\n', file=sys.stdout if print_errors_as_information else sys.stderr, flush=True)
|
|
1492
1494
|
if 0 < len(stderr):
|
|
1493
1495
|
stderr = stderr+"\n"
|
|
1494
1496
|
stderr = stderr+err_line
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
ScriptCollection/Executables.py,sha256=zxDRhv6UHzP0F9lFQvfPv8twy27BEA0-jIMvZfcZTb4,30016
|
|
2
|
-
ScriptCollection/GeneralUtilities.py,sha256=
|
|
2
|
+
ScriptCollection/GeneralUtilities.py,sha256=lOzmerW9jpokIHiUauraEwR15ACQbXsptLkEYZRyur0,40364
|
|
3
3
|
ScriptCollection/ProcessesRunner.py,sha256=3mu4ZxzZleQo0Op6o9EYTCFiJfb6kx5ov2YfZfT89mU,1395
|
|
4
4
|
ScriptCollection/ProgramRunnerBase.py,sha256=2kMIAqdc65UjBAddOZkzy_aFx9h5roZ5a4bQNM6RV6Y,2480
|
|
5
5
|
ScriptCollection/ProgramRunnerEpew.py,sha256=4pjEd0r9Fcz3TTDv0MdTSd5KkigYXcWUVI1X43regfU,6477
|
|
6
6
|
ScriptCollection/ProgramRunnerPopen.py,sha256=BPY7-ZMIlqT7JOKz8qlB5c0laF2Js-ijzqk09GxZC48,3821
|
|
7
7
|
ScriptCollection/RPStream.py,sha256=NRRHL3YSP3D9MuAV2jB_--0KUKCsvJGxeKnxgrRZ9kY,1545
|
|
8
|
-
ScriptCollection/ScriptCollectionCore.py,sha256=
|
|
8
|
+
ScriptCollection/ScriptCollectionCore.py,sha256=xkEBohmLhFZhd5lL0KQ0AD8Zyz7qSKWHSkB6nWsWr60,118788
|
|
9
9
|
ScriptCollection/TasksForCommonProjectStructure.py,sha256=n3x4XRyjabsL0SuMGZz3LJiq5ctjz7mMAS77QoAJFP8,215347
|
|
10
10
|
ScriptCollection/UpdateCertificates.py,sha256=Eynbgu7k9jLxApP2D_8Il77B6BFjJap6K7oTeEAZYbk,7790
|
|
11
11
|
ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
ScriptCollection-3.5.
|
|
13
|
-
ScriptCollection-3.5.
|
|
14
|
-
ScriptCollection-3.5.
|
|
15
|
-
ScriptCollection-3.5.
|
|
16
|
-
ScriptCollection-3.5.
|
|
12
|
+
ScriptCollection-3.5.76.dist-info/METADATA,sha256=qIPvrTGWHLk9JpfrVXmOlKewWMH_G1df-74XVkVLZJU,7664
|
|
13
|
+
ScriptCollection-3.5.76.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
14
|
+
ScriptCollection-3.5.76.dist-info/entry_points.txt,sha256=1jAL5AuB8mvdw2v-6E7wCZFThurQxchiQynL8DCi-Yg,3545
|
|
15
|
+
ScriptCollection-3.5.76.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
|
|
16
|
+
ScriptCollection-3.5.76.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|