ScriptCollection 3.5.74__py3-none-any.whl → 3.5.75__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.
@@ -925,7 +925,7 @@ class GeneralUtilities:
925
925
 
926
926
  @staticmethod
927
927
  @check_arguments
928
- def retry_action(action, amount_of_attempts: int) -> None:
928
+ def retry_action(action, amount_of_attempts: int,action_name:str=None) -> None:
929
929
  amount_of_fails = 0
930
930
  enabled = True
931
931
  while enabled:
@@ -936,6 +936,10 @@ class GeneralUtilities:
936
936
  amount_of_fails = amount_of_fails+1
937
937
  GeneralUtilities.assert_condition(not (amount_of_attempts < amount_of_fails))
938
938
  if amount_of_fails == amount_of_attempts:
939
+ message=f"Action failed {amount_of_attempts} times."
940
+ if action_name is not None:
941
+ message=f"{message} Name of action: {action_name}"
942
+ GeneralUtilities.write_exception_to_stderr(message)
939
943
  raise
940
944
  return None
941
945
 
@@ -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.74"
35
+ version = "3.5.75"
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
- stdout_result.append(q_stdout.get_nowait())
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
- stderr_result.append(q_stderr.get_nowait())
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,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ScriptCollection
3
- Version: 3.5.74
3
+ Version: 3.5.75
4
4
  Summary: The ScriptCollection is the place for reusable scripts.
5
5
  Home-page: https://github.com/anionDev/ScriptCollection
6
6
  Author: Marius Göcke
@@ -1,16 +1,16 @@
1
1
  ScriptCollection/Executables.py,sha256=zxDRhv6UHzP0F9lFQvfPv8twy27BEA0-jIMvZfcZTb4,30016
2
- ScriptCollection/GeneralUtilities.py,sha256=WSBawT958x_0H-hnPg3S3DGzP3KOQTADtZtP145I-M4,39473
2
+ ScriptCollection/GeneralUtilities.py,sha256=co7hYrwTHSqSSHukkRBNSnwSRD8t237wtO2vA0YkK4E,39766
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=LOm3hvX572Kbk7SL2FQSAvxUYBM2WezliFc6cI0PxEA,118614
8
+ ScriptCollection/ScriptCollectionCore.py,sha256=87yRWzemamkISYs-CW5Zs5dniulAk9A5yLtUDkLaaxg,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.74.dist-info/METADATA,sha256=tgYQrE5dKbrbv9Gz7_9pHYBhZlwFNuYo-iyDpCN-r14,7664
13
- ScriptCollection-3.5.74.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
14
- ScriptCollection-3.5.74.dist-info/entry_points.txt,sha256=1jAL5AuB8mvdw2v-6E7wCZFThurQxchiQynL8DCi-Yg,3545
15
- ScriptCollection-3.5.74.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
- ScriptCollection-3.5.74.dist-info/RECORD,,
12
+ ScriptCollection-3.5.75.dist-info/METADATA,sha256=6JiMoYzp7oM1cUYax-k5vff7q2cLW2_Xw4BeEMuvVto,7664
13
+ ScriptCollection-3.5.75.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
14
+ ScriptCollection-3.5.75.dist-info/entry_points.txt,sha256=1jAL5AuB8mvdw2v-6E7wCZFThurQxchiQynL8DCi-Yg,3545
15
+ ScriptCollection-3.5.75.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
+ ScriptCollection-3.5.75.dist-info/RECORD,,