ScriptCollection 3.5.119__py3-none-any.whl → 3.5.121__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/SCLog.py CHANGED
@@ -5,6 +5,7 @@ from .GeneralUtilities import GeneralUtilities
5
5
 
6
6
 
7
7
  class LogLevel(Enum):
8
+ Quiet = 0
8
9
  Error = 1
9
10
  Warning = 2
10
11
  Information = 3
@@ -19,10 +20,10 @@ class SCLog:
19
20
  log_file: str
20
21
  add_overhead: bool
21
22
 
22
- def __init__(self, log_file: str = None):
23
- self.add_overhead = False
24
- self.loglevel = LogLevel.Information
23
+ def __init__(self, log_file: str = None, loglevel: LogLevel = None, add_overhead: bool = False):
25
24
  self.log_file = log_file
25
+ self.loglevel = loglevel
26
+ self.add_overhead = add_overhead
26
27
 
27
28
  @GeneralUtilities.check_arguments
28
29
  def log_exception(self, message: str, ex: Exception, current_traceback):
@@ -30,41 +31,54 @@ class SCLog:
30
31
 
31
32
  @GeneralUtilities.check_arguments
32
33
  def log(self, message: str, loglevel: LogLevel = None):
34
+ for line in GeneralUtilities.string_to_lines(message, True, False):
35
+ self.__log_line(line, loglevel)
36
+
37
+ @GeneralUtilities.check_arguments
38
+ def __log_line(self, message: str, loglevel: LogLevel = None):
33
39
  if loglevel is None:
34
40
  loglevel = LogLevel.Information
35
41
 
36
42
  if int(loglevel) > int(self.loglevel):
37
43
  return
38
44
 
45
+ part1: str = ""
46
+ part2: str = ""
47
+ part3: str = message
48
+
39
49
  if loglevel == LogLevel.Warning:
40
- message = f"Warning: {message}"
50
+ part3 = f"Warning: {message}"
41
51
  if loglevel == LogLevel.Debug:
42
- message = f"Debug: {message}"
52
+ part3 = f"Debug: {message}"
43
53
  if self.add_overhead:
44
- if loglevel == LogLevel.Error:
45
- message = f"[Error] {message}"
54
+ part1 = f"[{GeneralUtilities.datetime_to_string_for_logfile_entry(datetime.now())}] ["
55
+ if loglevel == LogLevel.Information:
56
+ part2 = f"Information"
57
+ elif loglevel == LogLevel.Error:
58
+ part2 = f"Error"
46
59
  elif loglevel == LogLevel.Warning:
47
- message = f"[Warning] {message}"
60
+ part2 = f"Warning"
48
61
  elif loglevel == LogLevel.Debug:
49
- message = f"[Debug] {message}"
50
- elif loglevel == LogLevel.Information:
51
- message = f"[Information] {message}"
62
+ part2 = f"Debug"
52
63
  else:
53
64
  raise ValueError("Unknown loglevel.")
65
+ part3 = f"] {message}"
54
66
 
55
- message = f"[{GeneralUtilities.datetime_to_string_for_logfile_entry(datetime.now())}] {message}"
56
-
57
- if loglevel == LogLevel.Error:
58
- GeneralUtilities.write_message_to_stderr(message)
67
+ print_to_std_out: bool = loglevel in (LogLevel.Debug, LogLevel.Information)
68
+ GeneralUtilities.print_text(part1, print_to_std_out)
69
+ # if the control-characters for colors cause problems then maybe it can be checked with sys.stdout.isatty() if colors should be printed
70
+ if loglevel == LogLevel.Information:
71
+ GeneralUtilities.print_text_in_green(part2, print_to_std_out)
72
+ elif loglevel == LogLevel.Error:
73
+ GeneralUtilities.print_text_in_red(part2, print_to_std_out)
59
74
  elif loglevel == LogLevel.Warning:
60
- GeneralUtilities.write_message_to_stderr(message)
75
+ GeneralUtilities.print_text_in_yellow(part2, print_to_std_out)
61
76
  elif loglevel == LogLevel.Debug:
62
- GeneralUtilities.write_message_to_stdout(message)
63
- elif loglevel == LogLevel.Information:
64
- GeneralUtilities.write_message_to_stdout(message)
77
+ GeneralUtilities.print_text_in_cyan(part2, print_to_std_out)
65
78
  else:
66
79
  raise ValueError("Unknown loglevel.")
80
+ GeneralUtilities.print_text(part3+"\n", print_to_std_out)
67
81
 
68
82
  if self.log_file is not None:
69
83
  GeneralUtilities.ensure_file_exists(self.log_file)
70
- GeneralUtilities.append_line_to_file(self.log_file, message)
84
+ GeneralUtilities.append_line_to_file(self.log_file, part1+part2+part3)
@@ -1,4 +1,3 @@
1
- import sys
2
1
  from datetime import timedelta, datetime
3
2
  import json
4
3
  import binascii
@@ -28,12 +27,13 @@ import qrcode
28
27
  import pycdlib
29
28
  import send2trash
30
29
  from pypdf import PdfReader, PdfWriter
31
- from .GeneralUtilities import GeneralUtilities, VersionEcholon
30
+ from .GeneralUtilities import GeneralUtilities
32
31
  from .ProgramRunnerBase import ProgramRunnerBase
33
32
  from .ProgramRunnerPopen import ProgramRunnerPopen
34
33
  from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
34
+ from .SCLog import SCLog, LogLevel
35
35
 
36
- version = "3.5.119"
36
+ version = "3.5.121"
37
37
  __version__ = version
38
38
 
39
39
 
@@ -47,11 +47,13 @@ class ScriptCollectionCore:
47
47
  __mocked_program_calls: list = None
48
48
  program_runner: ProgramRunnerBase = None
49
49
  call_program_runner_directly: bool = None
50
+ log: SCLog = None
50
51
 
51
52
  def __init__(self):
52
53
  self.program_runner = ProgramRunnerPopen()
53
54
  self.call_program_runner_directly = None
54
55
  self.__mocked_program_calls = list[ScriptCollectionCore.__MockProgramCall]()
56
+ self.log = SCLog(None, LogLevel.Quiet, False)
55
57
 
56
58
  @staticmethod
57
59
  @GeneralUtilities.check_arguments
@@ -63,7 +65,7 @@ class ScriptCollectionCore:
63
65
  errors = list()
64
66
  filename = os.path.relpath(file, working_directory)
65
67
  if treat_warnings_as_errors:
66
- errorsonly_argument = ""
68
+ errorsonly_argument = GeneralUtilities.empty_string
67
69
  else:
68
70
  errorsonly_argument = " --errors-only"
69
71
  (exit_code, stdout, stderr, _) = self.run_program("pylint", filename + errorsonly_argument, working_directory, throw_exception_if_exitcode_is_not_zero=False)
@@ -167,14 +169,14 @@ class ScriptCollectionCore:
167
169
  @GeneralUtilities.check_arguments
168
170
  def get_parent_commit_ids_of_commit(self, repository_folder: str, commit_id: str) -> str:
169
171
  self.assert_is_git_repository(repository_folder)
170
- return self.run_program("git", f'log --pretty=%P -n 1 "{commit_id}"', repository_folder, throw_exception_if_exitcode_is_not_zero=True)[1].replace("\r", "").replace("\n", "").split(" ")
172
+ return self.run_program("git", f'log --pretty=%P -n 1 "{commit_id}"', repository_folder, throw_exception_if_exitcode_is_not_zero=True)[1].replace("\r", GeneralUtilities.empty_string).replace("\n", GeneralUtilities.empty_string).split(" ")
171
173
 
172
174
  @GeneralUtilities.check_arguments
173
175
  def get_all_authors_and_committers_of_repository(self, repository_folder: str, subfolder: str = None, verbosity: int = 1) -> list[tuple[str, str]]:
174
176
  self.assert_is_git_repository(repository_folder)
175
177
  space_character = "_"
176
178
  if subfolder is None:
177
- subfolder_argument = ""
179
+ subfolder_argument = GeneralUtilities.empty_string
178
180
  else:
179
181
  subfolder_argument = f" -- {subfolder}"
180
182
  log_result = self.run_program("git", f'log --pretty=%aN{space_character}%aE%n%cN{space_character}%cE HEAD{subfolder_argument}', repository_folder, verbosity=0)
@@ -194,7 +196,7 @@ class ScriptCollectionCore:
194
196
  self.assert_is_git_repository(repository_folder)
195
197
  since_as_string = self.__datetime_to_string_for_git(since)
196
198
  until_as_string = self.__datetime_to_string_for_git(until)
197
- result = filter(lambda line: not GeneralUtilities.string_is_none_or_whitespace(line), self.run_program("git", f'log --since "{since_as_string}" --until "{until_as_string}" --pretty=format:"%H" --no-patch', repository_folder, throw_exception_if_exitcode_is_not_zero=True)[1].split("\n").replace("\r", ""))
199
+ result = filter(lambda line: not GeneralUtilities.string_is_none_or_whitespace(line), self.run_program("git", f'log --since "{since_as_string}" --until "{until_as_string}" --pretty=format:"%H" --no-patch', repository_folder, throw_exception_if_exitcode_is_not_zero=True)[1].split("\n").replace("\r", GeneralUtilities.empty_string))
198
200
  if ignore_commits_which_are_not_in_history_of_head:
199
201
  result = [commit_id for commit_id in result if self.git_commit_is_ancestor(repository_folder, commit_id)]
200
202
  return result
@@ -428,10 +430,10 @@ class ScriptCollectionCore:
428
430
  self.git_stage_all_changes(directory)
429
431
  else:
430
432
  if no_changes_behavior == 0:
431
- GeneralUtilities.write_message_to_stdout(f"Commit '{message}' will not be done because there are no changes to commit in repository '{directory}'")
433
+ self.log.log(f"Commit '{message}' will not be done because there are no changes to commit in repository '{directory}'", LogLevel.Debug)
432
434
  do_commit = False
433
435
  elif no_changes_behavior == 1:
434
- GeneralUtilities.write_message_to_stdout(f"There are no changes to commit in repository '{directory}'. Commit '{message}' will be done anyway.")
436
+ self.log.log(f"There are no changes to commit in repository '{directory}'. Commit '{message}' will be done anyway.", LogLevel.Debug)
435
437
  do_commit = True
436
438
  elif no_changes_behavior == 2:
437
439
  raise RuntimeError(f"There are no changes to commit in repository '{directory}'. Commit '{message}' will not be done.")
@@ -439,7 +441,7 @@ class ScriptCollectionCore:
439
441
  raise ValueError(f"Unknown value for no_changes_behavior: {GeneralUtilities.str_none_safe(no_changes_behavior)}")
440
442
 
441
443
  if do_commit:
442
- GeneralUtilities.write_message_to_stdout(f"Commit changes in '{directory}'")
444
+ self.log.log(f"Commit changes in '{directory}'", LogLevel.Information)
443
445
  self.run_program_argsasarray("git", argument, directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
444
446
 
445
447
  return self.git_get_commit_id(directory)
@@ -557,19 +559,19 @@ class ScriptCollectionCore:
557
559
  def git_get_current_branch_name(self, repository: str) -> str:
558
560
  self.assert_is_git_repository(repository)
559
561
  result = self.run_program_argsasarray("git", ["rev-parse", "--abbrev-ref", "HEAD"], repository, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
560
- return result[1].replace("\r", "").replace("\n", "")
562
+ return result[1].replace("\r", GeneralUtilities.empty_string).replace("\n", GeneralUtilities.empty_string)
561
563
 
562
564
  @GeneralUtilities.check_arguments
563
565
  def git_get_commitid_of_tag(self, repository: str, tag: str) -> str:
564
566
  self.assert_is_git_repository(repository)
565
567
  stdout = self.run_program_argsasarray("git", ["rev-list", "-n", "1", tag], repository, verbosity=0)
566
- result = stdout[1].replace("\r", "").replace("\n", "")
568
+ result = stdout[1].replace("\r", GeneralUtilities.empty_string).replace("\n", GeneralUtilities.empty_string)
567
569
  return result
568
570
 
569
571
  @GeneralUtilities.check_arguments
570
572
  def git_get_tags(self, repository: str) -> list[str]:
571
573
  self.assert_is_git_repository(repository)
572
- tags = [line.replace("\r", "") for line in self.run_program_argsasarray(
574
+ tags = [line.replace("\r", GeneralUtilities.empty_string) for line in self.run_program_argsasarray(
573
575
  "git", ["tag"], repository)[1].split("\n") if len(line) > 0]
574
576
  return tags
575
577
 
@@ -581,7 +583,7 @@ class ScriptCollectionCore:
581
583
  counter = 0
582
584
  for tag in tags:
583
585
  counter = counter+1
584
- GeneralUtilities.write_message_to_stdout(f"Process tag {counter}/{tags_count}.")
586
+ self.log.log(f"Process tag {counter}/{tags_count}.", LogLevel.Information)
585
587
  # tag is on source-branch
586
588
  if self.git_commit_is_ancestor(repository, tag, tag_source_branch):
587
589
  commit_id_old = self.git_get_commitid_of_tag(repository, tag)
@@ -604,14 +606,14 @@ class ScriptCollectionCore:
604
606
  def get_latest_git_tag(self, repository_folder: str) -> str:
605
607
  self.assert_is_git_repository(repository_folder)
606
608
  result = self.run_program_argsasarray("git", ["describe", "--tags", "--abbrev=0"], repository_folder, verbosity=0)
607
- result = result[1].replace("\r", "").replace("\n", "")
609
+ result = result[1].replace("\r", GeneralUtilities.empty_string).replace("\n", GeneralUtilities.empty_string)
608
610
  return result
609
611
 
610
612
  @GeneralUtilities.check_arguments
611
613
  def get_staged_or_committed_git_ignored_files(self, repository_folder: str) -> list[str]:
612
614
  self.assert_is_git_repository(repository_folder)
613
615
  temp_result = self.run_program_argsasarray("git", ["ls-files", "-i", "-c", "--exclude-standard"], repository_folder, verbosity=0)
614
- temp_result = temp_result[1].replace("\r", "")
616
+ temp_result = temp_result[1].replace("\r", GeneralUtilities.empty_string)
615
617
  result = [line for line in temp_result.split("\n") if len(line) > 0]
616
618
  return result
617
619
 
@@ -1048,10 +1050,10 @@ class ScriptCollectionCore:
1048
1050
  elif (size_string.endswith("gib")):
1049
1051
  size = int(size_string[:-3]) * pow(2, 30)
1050
1052
  else:
1051
- GeneralUtilities.write_message_to_stderr("Wrong format")
1053
+ self.log.log("Wrong format", LogLevel.Error)
1052
1054
  return 1
1053
1055
  else:
1054
- GeneralUtilities.write_message_to_stderr("Wrong format")
1056
+ self.log.log("Wrong format", LogLevel.Error)
1055
1057
  return 1
1056
1058
  with open(name, "wb") as f:
1057
1059
  f.seek(size-1)
@@ -1115,7 +1117,7 @@ class ScriptCollectionCore:
1115
1117
 
1116
1118
  return 0
1117
1119
  else:
1118
- GeneralUtilities.write_message_to_stdout(f"File '{file}' does not exist")
1120
+ self.log.log(f"File '{file}' does not exist.", LogLevel.Error)
1119
1121
  return 1
1120
1122
 
1121
1123
  @GeneralUtilities.check_arguments
@@ -1194,8 +1196,7 @@ class ScriptCollectionCore:
1194
1196
  @GeneralUtilities.check_arguments
1195
1197
  def __print_qr_code_by_csv_line(self, displayname: str, website: str, emailaddress: str, key: str, period: str) -> None:
1196
1198
  qrcode_content = f"otpauth://totp/{website}:{emailaddress}?secret={key}&issuer={displayname}&period={period}"
1197
- GeneralUtilities.write_message_to_stdout(
1198
- f"{displayname} ({emailaddress}):")
1199
+ GeneralUtilities.write_message_to_stdout(f"{displayname} ({emailaddress}):")
1199
1200
  GeneralUtilities.write_message_to_stdout(qrcode_content)
1200
1201
  qr = qrcode.QRCode()
1201
1202
  qr.add_data(qrcode_content)
@@ -1243,7 +1244,7 @@ class ScriptCollectionCore:
1243
1244
  def __adjust_folder_name(self, folder: str) -> str:
1244
1245
  result = os.path.dirname(folder).replace("\\", "/")
1245
1246
  if result == "/":
1246
- return ""
1247
+ return GeneralUtilities.empty_string
1247
1248
  else:
1248
1249
  return result
1249
1250
 
@@ -1447,9 +1448,8 @@ class ScriptCollectionCore:
1447
1448
  ls_result = self.run_program_argsasarray("ls", ["-ld", file_or_folder])
1448
1449
  GeneralUtilities.assert_condition(ls_result[0] == 0, f"'ls -ld {file_or_folder}' resulted in exitcode {str(ls_result[0])}. StdErr: {ls_result[2]}")
1449
1450
  GeneralUtilities.assert_condition(not GeneralUtilities.string_is_none_or_whitespace(ls_result[1]), f"'ls -ld' of '{file_or_folder}' had an empty output. StdErr: '{ls_result[2]}'")
1450
- GeneralUtilities.write_message_to_stdout(ls_result[1])
1451
1451
  output = ls_result[1]
1452
- result = output.replace("\n", "")
1452
+ result = output.replace("\n", GeneralUtilities.empty_string)
1453
1453
  result = ' '.join(result.split()) # reduce multiple whitespaces to one
1454
1454
  return result
1455
1455
 
@@ -1460,7 +1460,6 @@ class ScriptCollectionCore:
1460
1460
  ls_result = self.run_program_argsasarray("ls", ["-la", file_or_folder])
1461
1461
  GeneralUtilities.assert_condition(ls_result[0] == 0, f"'ls -la {file_or_folder}' resulted in exitcode {str(ls_result[0])}. StdErr: {ls_result[2]}")
1462
1462
  GeneralUtilities.assert_condition(not GeneralUtilities.string_is_none_or_whitespace(ls_result[1]), f"'ls -la' of '{file_or_folder}' had an empty output. StdErr: '{ls_result[2]}'")
1463
- GeneralUtilities.write_message_to_stdout(ls_result[1])
1464
1463
  output = ls_result[1]
1465
1464
  result = output.split("\n")[3:] # skip the lines with "Total", "." and ".."
1466
1465
  result = [' '.join(line.split()) for line in result] # reduce multiple whitespaces to one
@@ -1520,7 +1519,7 @@ class ScriptCollectionCore:
1520
1519
  return False
1521
1520
 
1522
1521
  @staticmethod
1523
- def __read_popen_pipes(p: Popen, print_live_output: bool, print_errors_as_information: bool) -> tuple[list[str], list[str]]:
1522
+ def __read_popen_pipes(p: Popen, print_live_output: bool, print_errors_as_information: bool, log: SCLog) -> tuple[list[str], list[str]]:
1524
1523
  p_id = p.pid
1525
1524
  with ThreadPoolExecutor(2) as pool:
1526
1525
  q_stdout = Queue()
@@ -1538,31 +1537,33 @@ class ScriptCollectionCore:
1538
1537
  try:
1539
1538
  while not q_stdout.empty():
1540
1539
  out_line: str = q_stdout.get_nowait()
1541
- out_line = out_line.replace("\r", "").replace("\n", "")
1540
+ out_line = out_line.replace("\r", GeneralUtilities.empty_string).replace("\n", GeneralUtilities.empty_string)
1542
1541
  if GeneralUtilities.string_has_content(out_line):
1543
1542
  stdout_result.append(out_line)
1544
1543
  reading_stdout_last_time_resulted_in_exception = False
1545
1544
  if print_live_output:
1546
- print(out_line, end='\n', file=sys.stdout, flush=False)
1547
- if print_live_output:
1548
- sys.stdout.flush()
1545
+ # print(out_line, end='\n', file=sys.stdout, flush=False)
1546
+ log.log(out_line+"\n", LogLevel.Information)
1547
+ # if print_live_output:
1548
+ # sys.stdout.flush()
1549
1549
  except Empty:
1550
1550
  reading_stdout_last_time_resulted_in_exception = True
1551
1551
 
1552
1552
  try:
1553
1553
  while not q_stderr.empty():
1554
1554
  err_line: str = q_stderr.get_nowait()
1555
- err_line = err_line.replace("\r", "").replace("\n", "")
1555
+ err_line = err_line.replace("\r", GeneralUtilities.empty_string).replace("\n", GeneralUtilities.empty_string)
1556
1556
  if GeneralUtilities.string_has_content(err_line):
1557
1557
  stderr_result.append(err_line)
1558
1558
  reading_stderr_last_time_resulted_in_exception = False
1559
1559
  if print_live_output:
1560
- print(err_line, end='\n', file=sys.stdout if print_errors_as_information else sys.stderr, flush=False)
1561
- if print_live_output:
1562
- if print_errors_as_information:
1563
- sys.stdout.flush()
1564
- else:
1565
- sys.stderr.flush()
1560
+ # print(err_line, end='\n', file=sys.stdout if print_errors_as_information else sys.stderr, flush=False)
1561
+ log.log(err_line+"\n", LogLevel.Error if print_errors_as_information else LogLevel.Information)
1562
+ # if print_live_output:
1563
+ # if print_errors_as_information:
1564
+ # sys.stdout.flush()
1565
+ # else:
1566
+ # sys.stderr.flush()
1566
1567
  except Empty:
1567
1568
  reading_stderr_last_time_resulted_in_exception = True
1568
1569
 
@@ -1597,11 +1598,11 @@ class ScriptCollectionCore:
1597
1598
 
1598
1599
  verbose = verbosity > 2
1599
1600
  if verbose:
1600
- GeneralUtilities.write_message_to_stdout(f"Run '{info_for_log}'.")
1601
+ self.log.log(f"Run '{info_for_log}'.", LogLevel.Debug)
1601
1602
 
1602
1603
  exit_code: int = None
1603
- stdout: str = ""
1604
- stderr: str = ""
1604
+ stdout: str = GeneralUtilities.empty_string
1605
+ stderr: str = GeneralUtilities.empty_string
1605
1606
  pid: int = None
1606
1607
 
1607
1608
  with self.__run_program_argsasarray_async_helper(program, arguments_as_array, working_directory, verbosity, print_errors_as_information, log_file, timeoutInSeconds, addLogOverhead, title, log_namespace, arguments_for_log, custom_argument, interactive) as process:
@@ -1610,7 +1611,7 @@ class ScriptCollectionCore:
1610
1611
  GeneralUtilities.ensure_file_exists(log_file)
1611
1612
  pid = process.pid
1612
1613
 
1613
- outputs: tuple[list[str], list[str]] = ScriptCollectionCore.__read_popen_pipes(process, print_live_output, print_errors_as_information)
1614
+ outputs: tuple[list[str], list[str]] = ScriptCollectionCore.__read_popen_pipes(process, print_live_output, print_errors_as_information, self.log)
1614
1615
 
1615
1616
  for out_line_plain in outputs[0]:
1616
1617
  if out_line_plain is not None:
@@ -1655,7 +1656,7 @@ class ScriptCollectionCore:
1655
1656
  result_message = f"Program '{info_for_log}' resulted in exitcode {exit_code}."
1656
1657
 
1657
1658
  if verbose:
1658
- GeneralUtilities.write_message_to_stdout(result_message)
1659
+ self.log.log(result_message, LogLevel.Debug)
1659
1660
 
1660
1661
  if throw_exception_if_exitcode_is_not_zero and exit_code != 0:
1661
1662
  raise ValueError(f"{result_message} (StdOut: '{stdout}', StdErr: '{stderr}')")
@@ -1969,56 +1970,16 @@ DNS = {domain}
1969
1970
  def update_dependencies_of_dotnet_project(self, csproj_file: str, verbosity: int, ignored_dependencies: list[str]):
1970
1971
  folder = os.path.dirname(csproj_file)
1971
1972
  csproj_filename = os.path.basename(csproj_file)
1972
- GeneralUtilities.write_message_to_stdout(f"Check for updates in {csproj_filename}")
1973
+ self.log.log(f"Check for updates in {csproj_filename}", LogLevel.Information)
1973
1974
  result = self.run_program_with_retry("dotnet", f"list {csproj_filename} package --outdated", folder, print_errors_as_information=True)
1974
- for line in result[1].replace("\r", "").split("\n"):
1975
+ for line in result[1].replace("\r", GeneralUtilities.empty_string).split("\n"):
1975
1976
  # Relevant output-lines are something like " > NJsonSchema 10.7.0 10.7.0 10.9.0"
1976
1977
  if ">" in line:
1977
- package_name = line.replace(">", "").strip().split(" ")[0]
1978
+ package_name = line.replace(">", GeneralUtilities.empty_string).strip().split(" ")[0]
1978
1979
  if not (package_name in ignored_dependencies):
1979
- GeneralUtilities.write_message_to_stdout(f"Update package {package_name}...")
1980
+ self.log.log(f"Update package {package_name}...", LogLevel.Debug)
1980
1981
  self.run_program("dotnet", f"add {csproj_filename} package {package_name}", folder, print_errors_as_information=True)
1981
1982
 
1982
- @GeneralUtilities.check_arguments
1983
- def dotnet_package_is_available(self, package_name: str, package_version: str, source: str):
1984
- default_source_address = "nuget.org"
1985
- if source == default_source_address:
1986
- GeneralUtilities.write_message_to_stdout(f"Wait until package {package_name} v{package_version} is available on {source}.")
1987
- headers = {'Cache-Control': 'no-cache'}
1988
- r = requests.get(f"https://api.{default_source_address}/v3-flatcontainer/{package_name.lower()}/{package_version}/{package_name.lower()}.nuspec", timeout=5, headers=headers)
1989
- return r.status_code == 200
1990
- else:
1991
- raise ValueError(f"dotnet_package_is_available is not implemented yet for other sources than {default_source_address}.")
1992
-
1993
- @GeneralUtilities.check_arguments
1994
- def wait_until_dotnet_package_is_available(self, package_name: str, package_version: str, source: str):
1995
- return # TODO fix this
1996
- try: # pylint: disable=unreachable
1997
- while not self.dotnet_package_is_available(package_name, package_version, source):
1998
- time.sleep(30)
1999
- except:
2000
- pass
2001
-
2002
- @GeneralUtilities.check_arguments
2003
- def python_package_is_available(self, package_name: str, package_version: str, source: str):
2004
- default_source_address = "pypi.org"
2005
- if source == default_source_address:
2006
- GeneralUtilities.write_message_to_stdout(f"Wait until package {package_name} v{package_version} is available on {source}.")
2007
- headers = {'Cache-Control': 'no-cache'}
2008
- r = requests.get(f"https://{default_source_address}/pypi/{package_name}/{package_version}/json", timeout=5, headers=headers)
2009
- return r.status_code == 200
2010
- else:
2011
- raise ValueError(f"python_package_is_available is not implemented yet for other sources than {default_source_address}.")
2012
-
2013
- @GeneralUtilities.check_arguments
2014
- def wait_until_python_package_is_available(self, package_name: str, package_version: str, source: str):
2015
- return # TODO fix this
2016
- try: # pylint: disable=unreachable
2017
- while not self.python_package_is_available(package_name, package_version, source):
2018
- time.sleep(30)
2019
- except:
2020
- pass
2021
-
2022
1983
  @GeneralUtilities.check_arguments
2023
1984
  def create_deb_package(self, toolname: str, binary_folder: str, control_file_content: str, deb_output_folder: str, verbosity: int, permission_of_executable_file_as_octet_triple: int) -> None:
2024
1985
 
@@ -2330,47 +2291,3 @@ TXDX
2330
2291
  @GeneralUtilities.check_arguments
2331
2292
  def install_requirementstxt_file(self, requirements_txt_file: str, folder: str, verbosity: int):
2332
2293
  self.run_program_argsasarray("pip", ["install", "-r", requirements_txt_file], folder, verbosity=verbosity)
2333
-
2334
- @GeneralUtilities.check_arguments
2335
- def update_all_services_in_docker_compose_file(self, dockercompose_file: str, version_echolon: VersionEcholon):
2336
- raise ValueError("not implemented yet")
2337
-
2338
- @GeneralUtilities.check_arguments
2339
- def update_service_in_docker_compose_file(self, dockercompose_file: str, service_name: str, version_echolon: VersionEcholon):
2340
- raise ValueError("not implemented yet")
2341
-
2342
- @GeneralUtilities.check_arguments
2343
- def get_current_version_of_service_from_docker_compose_file(self, dockercompose_file: str, service_name: str):
2344
- raise ValueError("not implemented yet")
2345
-
2346
- @GeneralUtilities.check_arguments
2347
- def get_services_from_docker_compose_file(self, dockercompose_file: str):
2348
- raise ValueError("not implemented yet")
2349
-
2350
- @GeneralUtilities.check_arguments
2351
- def get_next_version_for_nginx(self, registry_address: str, current_version: str, version_echolon: VersionEcholon):
2352
- raise ValueError("not implemented yet")
2353
-
2354
- @GeneralUtilities.check_arguments
2355
- def get_next_version_for_prometheus(self, registry_address: str, current_version: str, version_echolon: VersionEcholon):
2356
- raise ValueError("not implemented yet")
2357
-
2358
- @GeneralUtilities.check_arguments
2359
- def get_next_version_for_blackbox_exporter(self, registry_address: str, current_version: str, version_echolon: VersionEcholon):
2360
- raise ValueError("not implemented yet")
2361
-
2362
- @GeneralUtilities.check_arguments
2363
- def get_next_version_for_gitlab(self, registry_address: str, current_version: str, version_echolon: VersionEcholon):
2364
- raise ValueError("not implemented yet")
2365
-
2366
- @GeneralUtilities.check_arguments
2367
- def get_next_version_for_nextcloud(self, registry_address: str, current_version: str, version_echolon: VersionEcholon):
2368
- raise ValueError("not implemented yet")
2369
-
2370
- @GeneralUtilities.check_arguments
2371
- def get_next_version_for_genericservice(self, registry_address: str, current_version: str, version_echolon: VersionEcholon, tag_prefix: str):
2372
- raise ValueError("not implemented yet")
2373
-
2374
- @GeneralUtilities.check_arguments
2375
- def get_all_available_tags(self, registry_address: str, service: str):
2376
- raise ValueError("not implemented yet")