ScriptCollection 3.5.165__py3-none-any.whl → 4.0.12__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.
@@ -36,7 +36,7 @@ from .ProgramRunnerPopen import ProgramRunnerPopen
36
36
  from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
37
37
  from .SCLog import SCLog, LogLevel
38
38
 
39
- version = "3.5.165"
39
+ version = "4.0.12"
40
40
  __version__ = version
41
41
 
42
42
 
@@ -44,7 +44,7 @@ class ScriptCollectionCore:
44
44
 
45
45
  # The purpose of this property is to use it when testing your code which uses scriptcollection for external program-calls.
46
46
  # Do not change this value for productive environments.
47
- mock_program_calls: bool = False
47
+ mock_program_calls: bool = False#TODO remove this variable. When someone want to mock program-calls then the ProgramRunnerMock can be used instead
48
48
  # The purpose of this property is to use it when testing your code which uses scriptcollection for external program-calls.
49
49
  execute_program_really_if_no_mock_call_is_defined: bool = False
50
50
  __mocked_program_calls: list = None
@@ -75,7 +75,7 @@ class ScriptCollectionCore:
75
75
  if (exit_code != 0):
76
76
  errors.append(f"Linting-issues of {file}:")
77
77
  errors.append(f"Pylint-exitcode: {exit_code}")
78
- for line in GeneralUtilities.string_to_lines(stdout):
78
+ for line in GeneralUtilities.string_to_lines(stdout):
79
79
  errors.append(line)
80
80
  for line in GeneralUtilities.string_to_lines(stderr):
81
81
  errors.append(line)
@@ -118,13 +118,13 @@ class ScriptCollectionCore:
118
118
  raise ValueError(f"Version '{current_version}' does not match version-regex '{versiononlyregex}'")
119
119
 
120
120
  @GeneralUtilities.check_arguments
121
- def push_nuget_build_artifact(self, nupkg_file: str, registry_address: str, api_key: str = None, verbosity: int = 1):
121
+ def push_nuget_build_artifact(self, nupkg_file: str, registry_address: str, api_key: str = None):
122
122
  nupkg_file_name = os.path.basename(nupkg_file)
123
123
  nupkg_file_folder = os.path.dirname(nupkg_file)
124
124
  argument = f"nuget push {nupkg_file_name} --force-english-output --source {registry_address}"
125
125
  if api_key is not None:
126
- argument = f"{argument} --api-key {api_key}"
127
- self.run_program("dotnet", argument, nupkg_file_folder, verbosity)
126
+ argument = f"{argument} --api-key {api_key}"
127
+ self.run_program("dotnet", argument, nupkg_file_folder, self.log.loglevel)
128
128
 
129
129
  @GeneralUtilities.check_arguments
130
130
  def dotnet_build(self, folder: str, projectname: str, configuration: str):
@@ -175,25 +175,6 @@ class ScriptCollectionCore:
175
175
  self.is_git_or_bare_git_repository(repository_folder)
176
176
  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(" ")
177
177
 
178
- @GeneralUtilities.check_arguments
179
- def get_all_authors_and_committers_of_repository(self, repository_folder: str, subfolder: str = None, verbosity: int = 1) -> list[tuple[str, str]]:
180
- self.is_git_or_bare_git_repository(repository_folder)
181
- space_character = "_"
182
- if subfolder is None:
183
- subfolder_argument = GeneralUtilities.empty_string
184
- else:
185
- subfolder_argument = f" -- {subfolder}"
186
- 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)
187
- plain_content: list[str] = list(
188
- set([line for line in log_result[1].split("\n") if len(line) > 0]))
189
- result: list[tuple[str, str]] = []
190
- for item in plain_content:
191
- if len(re.findall(space_character, item)) == 1:
192
- splitted = item.split(space_character)
193
- result.append((splitted[0], splitted[1]))
194
- else:
195
- raise ValueError(f'Unexpected author: "{item}"')
196
- return result
197
178
 
198
179
  @GeneralUtilities.check_arguments
199
180
  def get_commit_ids_between_dates(self, repository_folder: str, since: datetime, until: datetime, ignore_commits_which_are_not_in_history_of_head: bool = True) -> None:
@@ -224,7 +205,7 @@ class ScriptCollectionCore:
224
205
  @GeneralUtilities.check_arguments
225
206
  def __git_changes_helper(self, repository_folder: str, arguments_as_array: list[str]) -> bool:
226
207
  self.assert_is_git_repository(repository_folder)
227
- lines = GeneralUtilities.string_to_lines(self.run_program_argsasarray("git", arguments_as_array, repository_folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)[1], False)
208
+ lines = GeneralUtilities.string_to_lines(self.run_program_argsasarray("git", arguments_as_array, repository_folder, throw_exception_if_exitcode_is_not_zero=True)[1], False)
228
209
  for line in lines:
229
210
  if GeneralUtilities.string_has_content(line):
230
211
  return True
@@ -266,13 +247,13 @@ class ScriptCollectionCore:
266
247
  @GeneralUtilities.check_arguments
267
248
  def git_get_commit_id(self, repository_folder: str, commit: str = "HEAD") -> str:
268
249
  self.is_git_or_bare_git_repository(repository_folder)
269
- result: tuple[int, str, str, int] = self.run_program_argsasarray("git", ["rev-parse", "--verify", commit], repository_folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
250
+ result: tuple[int, str, str, int] = self.run_program_argsasarray("git", ["rev-parse", "--verify", commit], repository_folder, throw_exception_if_exitcode_is_not_zero=True)
270
251
  return result[1].replace('\n', '')
271
252
 
272
253
  @GeneralUtilities.check_arguments
273
254
  def git_get_commit_date(self, repository_folder: str, commit: str = "HEAD") -> datetime:
274
255
  self.is_git_or_bare_git_repository(repository_folder)
275
- result: tuple[int, str, str, int] = self.run_program_argsasarray("git", ["show", "-s", "--format=%ci", commit], repository_folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
256
+ result: tuple[int, str, str, int] = self.run_program_argsasarray("git", ["show", "-s", "--format=%ci", commit], repository_folder, throw_exception_if_exitcode_is_not_zero=True)
276
257
  date_as_string = result[1].replace('\n', '')
277
258
  result = datetime.strptime(date_as_string, '%Y-%m-%d %H:%M:%S %z')
278
259
  return result
@@ -284,31 +265,31 @@ class ScriptCollectionCore:
284
265
  @GeneralUtilities.check_arguments
285
266
  def git_fetch(self, folder: str, remotename: str = "--all") -> None:
286
267
  self.is_git_or_bare_git_repository(folder)
287
- self.run_program_argsasarray("git", ["fetch", remotename, "--tags", "--prune"], folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
268
+ self.run_program_argsasarray("git", ["fetch", remotename, "--tags", "--prune"], folder, throw_exception_if_exitcode_is_not_zero=True)
288
269
 
289
270
  @GeneralUtilities.check_arguments
290
271
  def git_fetch_in_bare_repository(self, folder: str, remotename, localbranch: str, remotebranch: str) -> None:
291
272
  self.is_git_or_bare_git_repository(folder)
292
- self.run_program_argsasarray("git", ["fetch", remotename, f"{remotebranch}:{localbranch}"], folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
273
+ self.run_program_argsasarray("git", ["fetch", remotename, f"{remotebranch}:{localbranch}"], folder, throw_exception_if_exitcode_is_not_zero=True)
293
274
 
294
275
  @GeneralUtilities.check_arguments
295
276
  def git_remove_branch(self, folder: str, branchname: str) -> None:
296
277
  self.is_git_or_bare_git_repository(folder)
297
- self.run_program("git", f"branch -D {branchname}", folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
278
+ self.run_program("git", f"branch -D {branchname}", folder, throw_exception_if_exitcode_is_not_zero=True)
298
279
 
299
280
  @GeneralUtilities.check_arguments
300
- def git_push_with_retry(self, folder: str, remotename: str, localbranchname: str, remotebranchname: str, forcepush: bool = False, pushalltags: bool = True, verbosity: int = 0, amount_of_attempts: int = 5) -> None:
281
+ def git_push_with_retry(self, folder: str, remotename: str, localbranchname: str, remotebranchname: str, forcepush: bool = False, pushalltags: bool = True, verbosity: LogLevel = LogLevel.Quiet, amount_of_attempts: int = 5) -> None:
301
282
  GeneralUtilities.retry_action(lambda: self.git_push(folder, remotename, localbranchname, remotebranchname, forcepush, pushalltags, verbosity), amount_of_attempts)
302
283
 
303
284
  @GeneralUtilities.check_arguments
304
- def git_push(self, folder: str, remotename: str, localbranchname: str, remotebranchname: str, forcepush: bool = False, pushalltags: bool = True, verbosity: int = 0) -> None:
285
+ def git_push(self, folder: str, remotename: str, localbranchname: str, remotebranchname: str, forcepush: bool = False, pushalltags: bool = True, verbosity: LogLevel = LogLevel.Quiet) -> None:
305
286
  self.is_git_or_bare_git_repository(folder)
306
287
  argument = ["push", "--recurse-submodules=on-demand", remotename, f"{localbranchname}:{remotebranchname}"]
307
288
  if (forcepush):
308
289
  argument.append("--force")
309
290
  if (pushalltags):
310
291
  argument.append("--tags")
311
- result: tuple[int, str, str, int] = self.run_program_argsasarray("git", argument, folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=verbosity, print_errors_as_information=True)
292
+ result: tuple[int, str, str, int] = self.run_program_argsasarray("git", argument, folder, throw_exception_if_exitcode_is_not_zero=True, print_errors_as_information=True)
312
293
  return result[1].replace('\r', '').replace('\n', '')
313
294
 
314
295
  @GeneralUtilities.check_arguments
@@ -321,14 +302,14 @@ class ScriptCollectionCore:
321
302
  argument = f"pull {remote} {remotebranchname}:{localbranchname}"
322
303
  if force:
323
304
  argument = f"{argument} --force"
324
- self.run_program("git", argument, folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
305
+ self.run_program("git", argument, folder, throw_exception_if_exitcode_is_not_zero=True)
325
306
 
326
307
  @GeneralUtilities.check_arguments
327
308
  def git_list_remote_branches(self, folder: str, remote: str, fetch: bool) -> list[str]:
328
309
  self.is_git_or_bare_git_repository(folder)
329
310
  if fetch:
330
311
  self.git_fetch(folder, remote)
331
- run_program_result = self.run_program("git", f"branch -rl {remote}/*", folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
312
+ run_program_result = self.run_program("git", f"branch -rl {remote}/*", folder, throw_exception_if_exitcode_is_not_zero=True)
332
313
  output = GeneralUtilities.string_to_lines(run_program_result[1])
333
314
  result = list[str]()
334
315
  for item in output:
@@ -355,18 +336,18 @@ class ScriptCollectionCore:
355
336
  args.append("--remote-submodules")
356
337
  if mirror:
357
338
  args.append("--mirror")
358
- self.run_program_argsasarray("git", args, os.getcwd(), throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
339
+ self.run_program_argsasarray("git", args, os.getcwd(), throw_exception_if_exitcode_is_not_zero=True)
359
340
 
360
341
  @GeneralUtilities.check_arguments
361
342
  def git_get_all_remote_names(self, directory: str) -> list[str]:
362
343
  self.is_git_or_bare_git_repository(directory)
363
- result = GeneralUtilities.string_to_lines(self.run_program_argsasarray("git", ["remote"], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)[1], False)
344
+ result = GeneralUtilities.string_to_lines(self.run_program_argsasarray("git", ["remote"], directory, throw_exception_if_exitcode_is_not_zero=True)[1], False)
364
345
  return result
365
346
 
366
347
  @GeneralUtilities.check_arguments
367
348
  def git_get_remote_url(self, directory: str, remote_name: str) -> str:
368
349
  self.is_git_or_bare_git_repository(directory)
369
- result = GeneralUtilities.string_to_lines(self.run_program_argsasarray("git", ["remote", "get-url", remote_name], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)[1], False)
350
+ result = GeneralUtilities.string_to_lines(self.run_program_argsasarray("git", ["remote", "get-url", remote_name], directory, throw_exception_if_exitcode_is_not_zero=True)[1], False)
370
351
  return result[0].replace('\n', '')
371
352
 
372
353
  @GeneralUtilities.check_arguments
@@ -378,43 +359,43 @@ class ScriptCollectionCore:
378
359
  def git_add_or_set_remote_address(self, directory: str, remote_name: str, remote_address: str) -> None:
379
360
  self.assert_is_git_repository(directory)
380
361
  if (self.repository_has_remote_with_specific_name(directory, remote_name)):
381
- self.run_program_argsasarray("git", ['remote', 'set-url', 'remote_name', remote_address], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
362
+ self.run_program_argsasarray("git", ['remote', 'set-url', 'remote_name', remote_address], directory, throw_exception_if_exitcode_is_not_zero=True)
382
363
  else:
383
- self.run_program_argsasarray("git", ['remote', 'add', remote_name, remote_address], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
364
+ self.run_program_argsasarray("git", ['remote', 'add', remote_name, remote_address], directory, throw_exception_if_exitcode_is_not_zero=True)
384
365
 
385
366
  @GeneralUtilities.check_arguments
386
367
  def git_stage_all_changes(self, directory: str) -> None:
387
368
  self.assert_is_git_repository(directory)
388
- self.run_program_argsasarray("git", ["add", "-A"], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
369
+ self.run_program_argsasarray("git", ["add", "-A"], directory, throw_exception_if_exitcode_is_not_zero=True)
389
370
 
390
371
  @GeneralUtilities.check_arguments
391
372
  def git_unstage_all_changes(self, directory: str) -> None:
392
373
  self.assert_is_git_repository(directory)
393
- self.run_program_argsasarray("git", ["reset"], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
374
+ self.run_program_argsasarray("git", ["reset"], directory, throw_exception_if_exitcode_is_not_zero=True)
394
375
  # TODO check if this will also be done for submodules
395
376
 
396
377
  @GeneralUtilities.check_arguments
397
378
  def git_stage_file(self, directory: str, file: str) -> None:
398
379
  self.assert_is_git_repository(directory)
399
- self.run_program_argsasarray("git", ['stage', file], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
380
+ self.run_program_argsasarray("git", ['stage', file], directory, throw_exception_if_exitcode_is_not_zero=True)
400
381
 
401
382
  @GeneralUtilities.check_arguments
402
383
  def git_unstage_file(self, directory: str, file: str) -> None:
403
384
  self.assert_is_git_repository(directory)
404
- self.run_program_argsasarray("git", ['reset', file], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
385
+ self.run_program_argsasarray("git", ['reset', file], directory, throw_exception_if_exitcode_is_not_zero=True)
405
386
 
406
387
  @GeneralUtilities.check_arguments
407
388
  def git_discard_unstaged_changes_of_file(self, directory: str, file: str) -> None:
408
389
  """Caution: This method works really only for 'changed' files yet. So this method does not work properly for new or renamed files."""
409
390
  self.assert_is_git_repository(directory)
410
- self.run_program_argsasarray("git", ['checkout', file], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
391
+ self.run_program_argsasarray("git", ['checkout', file], directory, throw_exception_if_exitcode_is_not_zero=True)
411
392
 
412
393
  @GeneralUtilities.check_arguments
413
394
  def git_discard_all_unstaged_changes(self, directory: str) -> None:
414
395
  """Caution: This function executes 'git clean -df'. This can delete files which maybe should not be deleted. Be aware of that."""
415
396
  self.assert_is_git_repository(directory)
416
- self.run_program_argsasarray("git", ['clean', '-df'], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
417
- self.run_program_argsasarray("git", ['checkout', '.'], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
397
+ self.run_program_argsasarray("git", ['clean', '-df'], directory, throw_exception_if_exitcode_is_not_zero=True)
398
+ self.run_program_argsasarray("git", ['checkout', '.'], directory, throw_exception_if_exitcode_is_not_zero=True)
418
399
  # TODO check if this will also be done for submodules
419
400
 
420
401
  @GeneralUtilities.check_arguments
@@ -446,9 +427,22 @@ class ScriptCollectionCore:
446
427
 
447
428
  if do_commit:
448
429
  self.log.log(f"Commit changes in '{directory}'", LogLevel.Information)
449
- self.run_program_argsasarray("git", argument, directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
430
+ self.run_program_argsasarray("git", argument, directory, throw_exception_if_exitcode_is_not_zero=True)
450
431
 
451
432
  return self.git_get_commit_id(directory)
433
+
434
+ def search_repository_folder(self,some_file_in_repository:str)->str:
435
+ current_path:str=os.path.dirname(some_file_in_repository)
436
+ enabled:bool=True
437
+ while enabled:
438
+ try:
439
+ current_path=GeneralUtilities.resolve_relative_path("..",current_path)
440
+ if self.is_git_repository(current_path):
441
+ return current_path
442
+ except:
443
+ enabled=False
444
+ raise ValueError(f"Can not find git-repository for folder \"{some_file_in_repository}\".")
445
+
452
446
 
453
447
  @GeneralUtilities.check_arguments
454
448
  def git_create_tag(self, directory: str, target_for_tag: str, tag: str, sign: bool = False, message: str = None) -> None:
@@ -458,20 +452,20 @@ class ScriptCollectionCore:
458
452
  if message is None:
459
453
  message = f"Created {target_for_tag}"
460
454
  argument.extend(["-s", '-m', message])
461
- self.run_program_argsasarray("git", argument, directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
455
+ self.run_program_argsasarray("git", argument, directory, throw_exception_if_exitcode_is_not_zero=True)
462
456
 
463
457
  @GeneralUtilities.check_arguments
464
458
  def git_delete_tag(self, directory: str, tag: str) -> None:
465
459
  self.is_git_or_bare_git_repository(directory)
466
- self.run_program_argsasarray("git", ["tag", "--delete", tag], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
460
+ self.run_program_argsasarray("git", ["tag", "--delete", tag], directory, throw_exception_if_exitcode_is_not_zero=True)
467
461
 
468
462
  @GeneralUtilities.check_arguments
469
463
  def git_checkout(self, directory: str, branch: str, undo_all_changes_after_checkout: bool = True, assert_no_uncommitted_changes: bool = True) -> None:
470
464
  self.assert_is_git_repository(directory)
471
465
  if assert_no_uncommitted_changes:
472
466
  GeneralUtilities.assert_condition(not self.git_repository_has_uncommitted_changes(directory), f"Repository '{directory}' has uncommitted changes.")
473
- self.run_program_argsasarray("git", ["checkout", branch], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
474
- self.run_program_argsasarray("git", ["submodule", "update", "--recursive"], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
467
+ self.run_program_argsasarray("git", ["checkout", branch], directory, throw_exception_if_exitcode_is_not_zero=True)
468
+ self.run_program_argsasarray("git", ["submodule", "update", "--recursive"], directory, throw_exception_if_exitcode_is_not_zero=True)
475
469
  if undo_all_changes_after_checkout:
476
470
  self.git_undo_all_changes(directory)
477
471
 
@@ -495,7 +489,7 @@ class ScriptCollectionCore:
495
489
  @GeneralUtilities.check_arguments
496
490
  def git_merge_abort(self, directory: str) -> None:
497
491
  self.assert_is_git_repository(directory)
498
- self.run_program_argsasarray("git", ["merge", "--abort"], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
492
+ self.run_program_argsasarray("git", ["merge", "--abort"], directory, throw_exception_if_exitcode_is_not_zero=True)
499
493
 
500
494
  @GeneralUtilities.check_arguments
501
495
  def git_merge(self, directory: str, sourcebranch: str, targetbranch: str, fastforward: bool = True, commit: bool = True, commit_message: str = None, undo_all_changes_after_checkout: bool = True, assert_no_uncommitted_changes: bool = True) -> str:
@@ -510,8 +504,8 @@ class ScriptCollectionCore:
510
504
  args.append("-m")
511
505
  args.append(commit_message)
512
506
  args.append(sourcebranch)
513
- self.run_program_argsasarray("git", args, directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
514
- self.run_program_argsasarray("git", ["submodule", "update"], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
507
+ self.run_program_argsasarray("git", args, directory, throw_exception_if_exitcode_is_not_zero=True)
508
+ self.run_program_argsasarray("git", ["submodule", "update"], directory, throw_exception_if_exitcode_is_not_zero=True)
515
509
  return self.git_get_commit_id(directory)
516
510
 
517
511
  @GeneralUtilities.check_arguments
@@ -546,7 +540,7 @@ class ScriptCollectionCore:
546
540
  @GeneralUtilities.check_arguments
547
541
  def file_is_git_ignored(self, file_in_repository: str, repositorybasefolder: str) -> None:
548
542
  self.is_git_or_bare_git_repository(repositorybasefolder)
549
- exit_code = self.run_program_argsasarray("git", ['check-ignore', file_in_repository], repositorybasefolder, throw_exception_if_exitcode_is_not_zero=False, verbosity=0)[0]
543
+ exit_code = self.run_program_argsasarray("git", ['check-ignore', file_in_repository], repositorybasefolder, throw_exception_if_exitcode_is_not_zero=False)[0]
550
544
  if (exit_code == 0):
551
545
  return True
552
546
  if (exit_code == 1):
@@ -556,19 +550,19 @@ class ScriptCollectionCore:
556
550
  @GeneralUtilities.check_arguments
557
551
  def git_discard_all_changes(self, repository: str) -> None:
558
552
  self.assert_is_git_repository(repository)
559
- self.run_program_argsasarray("git", ["reset", "HEAD", "."], repository, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
560
- self.run_program_argsasarray("git", ["checkout", "."], repository, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
553
+ self.run_program_argsasarray("git", ["reset", "HEAD", "."], repository, throw_exception_if_exitcode_is_not_zero=True)
554
+ self.run_program_argsasarray("git", ["checkout", "."], repository, throw_exception_if_exitcode_is_not_zero=True)
561
555
 
562
556
  @GeneralUtilities.check_arguments
563
557
  def git_get_current_branch_name(self, repository: str) -> str:
564
558
  self.assert_is_git_repository(repository)
565
- result = self.run_program_argsasarray("git", ["rev-parse", "--abbrev-ref", "HEAD"], repository, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
559
+ result = self.run_program_argsasarray("git", ["rev-parse", "--abbrev-ref", "HEAD"], repository, throw_exception_if_exitcode_is_not_zero=True)
566
560
  return result[1].replace("\r", GeneralUtilities.empty_string).replace("\n", GeneralUtilities.empty_string)
567
561
 
568
562
  @GeneralUtilities.check_arguments
569
563
  def git_get_commitid_of_tag(self, repository: str, tag: str) -> str:
570
564
  self.is_git_or_bare_git_repository(repository)
571
- stdout = self.run_program_argsasarray("git", ["rev-list", "-n", "1", tag], repository, verbosity=0)
565
+ stdout = self.run_program_argsasarray("git", ["rev-list", "-n", "1", tag], repository)
572
566
  result = stdout[1].replace("\r", GeneralUtilities.empty_string).replace("\n", GeneralUtilities.empty_string)
573
567
  return result
574
568
 
@@ -603,20 +597,20 @@ class ScriptCollectionCore:
603
597
  @GeneralUtilities.check_arguments
604
598
  def get_current_git_branch_has_tag(self, repository_folder: str) -> bool:
605
599
  self.is_git_or_bare_git_repository(repository_folder)
606
- result = self.run_program_argsasarray("git", ["describe", "--tags", "--abbrev=0"], repository_folder, verbosity=0, throw_exception_if_exitcode_is_not_zero=False)
600
+ result = self.run_program_argsasarray("git", ["describe", "--tags", "--abbrev=0"], repository_folder, throw_exception_if_exitcode_is_not_zero=False)
607
601
  return result[0] == 0
608
602
 
609
603
  @GeneralUtilities.check_arguments
610
604
  def get_latest_git_tag(self, repository_folder: str) -> str:
611
605
  self.is_git_or_bare_git_repository(repository_folder)
612
- result = self.run_program_argsasarray("git", ["describe", "--tags", "--abbrev=0"], repository_folder, verbosity=0)
606
+ result = self.run_program_argsasarray("git", ["describe", "--tags", "--abbrev=0"], repository_folder)
613
607
  result = result[1].replace("\r", GeneralUtilities.empty_string).replace("\n", GeneralUtilities.empty_string)
614
608
  return result
615
609
 
616
610
  @GeneralUtilities.check_arguments
617
611
  def get_staged_or_committed_git_ignored_files(self, repository_folder: str) -> list[str]:
618
612
  self.assert_is_git_repository(repository_folder)
619
- temp_result = self.run_program_argsasarray("git", ["ls-files", "-i", "-c", "--exclude-standard"], repository_folder, verbosity=0)
613
+ temp_result = self.run_program_argsasarray("git", ["ls-files", "-i", "-c", "--exclude-standard"], repository_folder)
620
614
  temp_result = temp_result[1].replace("\r", GeneralUtilities.empty_string)
621
615
  result = [line for line in temp_result.split("\n") if len(line) > 0]
622
616
  return result
@@ -686,7 +680,8 @@ class ScriptCollectionCore:
686
680
  @GeneralUtilities.check_arguments
687
681
  def is_git_repository(self, folder: str) -> bool:
688
682
  """This function works platform-independent also for non-local-executions if the ScriptCollection commandline-commands are available as global command on the target-system."""
689
- if folder.endswith("/") or folder.endswith("\\"):
683
+ folder=folder.replace("\\","/")
684
+ if folder.endswith("/"):
690
685
  folder = folder[:-1]
691
686
  if not self.is_folder(folder):
692
687
  raise ValueError(f"Folder '{folder}' does not exist.")
@@ -725,6 +720,11 @@ class ScriptCollectionCore:
725
720
  GeneralUtilities.ensure_directory_does_not_exist(repository_folder)
726
721
  self.run_program_argsasarray("git", ["config", "--bool", "core.bare", "true"], target_folder)
727
722
 
723
+ @GeneralUtilities.check_arguments
724
+ def assert_no_uncommitted_changes(self, repository_folder: str):
725
+ if self.git_repository_has_uncommitted_changes(repository_folder):
726
+ raise ValueError(f"Repository '{repository_folder}' has uncommitted changes.")
727
+
728
728
  @GeneralUtilities.check_arguments
729
729
  def list_content(self, path: str, include_files: bool, include_folder: bool, printonlynamewithoutpath: bool) -> list[str]:
730
730
  """This function works platform-independent also for non-local-executions if the ScriptCollection commandline-commands are available as global command on the target-system."""
@@ -1544,9 +1544,9 @@ class ScriptCollectionCore:
1544
1544
  # <run programs>
1545
1545
 
1546
1546
  @GeneralUtilities.check_arguments
1547
- 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:
1547
+ def __run_program_argsasarray_async_helper(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, 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:
1548
1548
  if isinstance(self.program_runner, ProgramRunnerEpew):
1549
- custom_argument = CustomEpewArgument(print_errors_as_information, log_file, timeoutInSeconds, addLogOverhead, title, log_namespace, verbosity, arguments_for_log)
1549
+ custom_argument = CustomEpewArgument(print_errors_as_information, log_file, timeoutInSeconds, addLogOverhead, title, log_namespace,self.log.loglevel, arguments_for_log)
1550
1550
  popen: Popen = self.program_runner.run_program_argsasarray_async_helper(program, arguments_as_array, working_directory, custom_argument, interactive)
1551
1551
  return popen
1552
1552
 
@@ -1596,7 +1596,6 @@ class ScriptCollectionCore:
1596
1596
  stdout_result.append(out_line)
1597
1597
  reading_stdout_last_time_resulted_in_exception = False
1598
1598
  if print_live_output:
1599
- # print(out_line, end='\n', file=sys.stdout, flush=False)
1600
1599
  loglevel = LogLevel.Information
1601
1600
  if out_line.startswith("Debug: "):
1602
1601
  loglevel = LogLevel.Debug
@@ -1605,8 +1604,6 @@ class ScriptCollectionCore:
1605
1604
  loglevel = LogLevel.Diagnostic
1606
1605
  out_line = out_line[len("Diagnostic: "):]
1607
1606
  log.log(out_line, loglevel)
1608
- # if print_live_output:
1609
- # sys.stdout.flush()
1610
1607
  except Empty:
1611
1608
  reading_stdout_last_time_resulted_in_exception = True
1612
1609
 
@@ -1618,7 +1615,6 @@ class ScriptCollectionCore:
1618
1615
  stderr_result.append(err_line)
1619
1616
  reading_stderr_last_time_resulted_in_exception = False
1620
1617
  if print_live_output:
1621
- # print(err_line, end='\n', file=sys.stdout if print_errors_as_information else sys.stderr, flush=False)
1622
1618
  loglevel = LogLevel.Error
1623
1619
  if err_line.startswith("Warning: "):
1624
1620
  loglevel = LogLevel.Warning
@@ -1626,11 +1622,6 @@ class ScriptCollectionCore:
1626
1622
  if print_errors_as_information: # "errors" in "print_errors_as_information" means: all what is written to std-err
1627
1623
  loglevel = LogLevel.Information
1628
1624
  log.log(err_line, loglevel)
1629
- # if print_live_output:
1630
- # if print_errors_as_information:
1631
- # sys.stdout.flush()
1632
- # else:
1633
- # sys.stderr.flush()
1634
1625
  except Empty:
1635
1626
  reading_stderr_last_time_resulted_in_exception = True
1636
1627
 
@@ -1639,7 +1630,7 @@ class ScriptCollectionCore:
1639
1630
  return (stdout_result, stderr_result)
1640
1631
 
1641
1632
  @GeneralUtilities.check_arguments
1642
- def run_program_argsasarray(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, verbosity: int = 0, 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, throw_exception_if_exitcode_is_not_zero: bool = True, custom_argument: object = None, interactive: bool = False, print_live_output: bool = False) -> tuple[int, str, str, int]:
1633
+ def run_program_argsasarray(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, 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, throw_exception_if_exitcode_is_not_zero: bool = True, custom_argument: object = None, interactive: bool = False, print_live_output: bool = False) -> tuple[int, str, str, int]:
1643
1634
  if self.call_program_runner_directly:
1644
1635
  return self.program_runner.run_program_argsasarray(program, arguments_as_array, working_directory, custom_argument, interactive)
1645
1636
  try:
@@ -1663,17 +1654,14 @@ class ScriptCollectionCore:
1663
1654
  else:
1664
1655
  info_for_log = title
1665
1656
 
1666
- verbose = verbosity > 2
1667
- if verbose:
1668
- self.log.log(f"Run '{info_for_log}'.", LogLevel.Debug)
1669
- self.log.log(f"Run '{info_for_log}' with the following properties: verbosity={verbosity}; timeoutInSeconds={timeoutInSeconds}, print_live_output={print_live_output}.", LogLevel.Diagnostic)
1657
+ self.log.log(f"Run '{info_for_log}'.", LogLevel.Debug)
1670
1658
 
1671
1659
  exit_code: int = None
1672
1660
  stdout: str = GeneralUtilities.empty_string
1673
1661
  stderr: str = GeneralUtilities.empty_string
1674
1662
  pid: int = None
1675
1663
 
1676
- 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:
1664
+ with self.__run_program_argsasarray_async_helper(program, arguments_as_array, working_directory, print_errors_as_information, log_file, timeoutInSeconds, addLogOverhead, title, log_namespace, arguments_for_log, custom_argument, interactive) as process:
1677
1665
 
1678
1666
  if log_file is not None:
1679
1667
  GeneralUtilities.ensure_file_exists(log_file)
@@ -1723,46 +1711,45 @@ class ScriptCollectionCore:
1723
1711
 
1724
1712
  result_message = f"Program '{info_for_log}' resulted in exitcode {exit_code}."
1725
1713
 
1726
- if verbose:
1727
- self.log.log(result_message, LogLevel.Debug)
1714
+ self.log.log(result_message, LogLevel.Debug)
1728
1715
 
1729
1716
  if throw_exception_if_exitcode_is_not_zero and exit_code != 0:
1730
1717
  raise ValueError(f"{result_message} (StdOut: '{stdout}', StdErr: '{stderr}')")
1731
1718
 
1732
1719
  result = (exit_code, stdout, stderr, pid)
1733
1720
  return result
1734
- except Exception as e:
1735
- raise e
1721
+ except Exception as e:#pylint:disable=unused-variable, try-except-raise
1722
+ raise
1736
1723
 
1737
1724
  # Return-values program_runner: Exitcode, StdOut, StdErr, Pid
1738
1725
  @GeneralUtilities.check_arguments
1739
- def run_program_with_retry(self, program: str, arguments: 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, throw_exception_if_exitcode_is_not_zero: bool = True, custom_argument: object = None, interactive: bool = False, print_live_output: bool = False, amount_of_attempts: int = 5) -> tuple[int, str, str, int]:
1740
- return GeneralUtilities.retry_action(lambda: self.run_program(program, arguments, working_directory, verbosity, print_errors_as_information, log_file, timeoutInSeconds, addLogOverhead, title, log_namespace, arguments_for_log, throw_exception_if_exitcode_is_not_zero, custom_argument, interactive, print_live_output), amount_of_attempts)
1726
+ def run_program_with_retry(self, program: str, arguments: str = "", working_directory: str = None, 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, throw_exception_if_exitcode_is_not_zero: bool = True, custom_argument: object = None, interactive: bool = False, print_live_output: bool = False, amount_of_attempts: int = 5) -> tuple[int, str, str, int]:
1727
+ return GeneralUtilities.retry_action(lambda: self.run_program(program, arguments, working_directory, print_errors_as_information, log_file, timeoutInSeconds, addLogOverhead, title, log_namespace, arguments_for_log, throw_exception_if_exitcode_is_not_zero, custom_argument, interactive, print_live_output), amount_of_attempts)
1741
1728
 
1742
1729
  # Return-values program_runner: Exitcode, StdOut, StdErr, Pid
1743
1730
  @GeneralUtilities.check_arguments
1744
- def run_program(self, program: str, arguments: 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, throw_exception_if_exitcode_is_not_zero: bool = True, custom_argument: object = None, interactive: bool = False, print_live_output: bool = False) -> tuple[int, str, str, int]:
1731
+ def run_program(self, program: str, arguments: str = "", working_directory: str = None, 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, throw_exception_if_exitcode_is_not_zero: bool = True, custom_argument: object = None, interactive: bool = False, print_live_output: bool = False) -> tuple[int, str, str, int]:
1745
1732
  if self.call_program_runner_directly:
1746
1733
  return self.program_runner.run_program(program, arguments, working_directory, custom_argument, interactive)
1747
- return self.run_program_argsasarray(program, GeneralUtilities.arguments_to_array(arguments), working_directory, verbosity, print_errors_as_information, log_file, timeoutInSeconds, addLogOverhead, title, log_namespace, arguments_for_log, throw_exception_if_exitcode_is_not_zero, custom_argument, interactive, print_live_output)
1734
+ return self.run_program_argsasarray(program, GeneralUtilities.arguments_to_array(arguments), working_directory, print_errors_as_information, log_file, timeoutInSeconds, addLogOverhead, title, log_namespace, arguments_for_log, throw_exception_if_exitcode_is_not_zero, custom_argument, interactive, print_live_output)
1748
1735
 
1749
1736
  # Return-values program_runner: Pid
1750
1737
  @GeneralUtilities.check_arguments
1751
- def run_program_argsasarray_async(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) -> int:
1738
+ def run_program_argsasarray_async(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, 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) -> int:
1752
1739
  if self.call_program_runner_directly:
1753
1740
  return self.program_runner.run_program_argsasarray_async(program, arguments_as_array, working_directory, custom_argument, interactive)
1754
1741
  mock_loader_result = self.__try_load_mock(program, ' '.join(arguments_as_array), working_directory)
1755
1742
  if mock_loader_result[0]:
1756
1743
  return mock_loader_result[1]
1757
- process: Popen = 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)
1744
+ process: Popen = self.__run_program_argsasarray_async_helper(program, arguments_as_array, working_directory, print_errors_as_information, log_file, timeoutInSeconds, addLogOverhead, title, log_namespace, arguments_for_log, custom_argument, interactive)
1758
1745
  return process.pid
1759
1746
 
1760
1747
  # Return-values program_runner: Pid
1761
1748
  @GeneralUtilities.check_arguments
1762
- def run_program_async(self, program: str, arguments: 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) -> int:
1749
+ def run_program_async(self, program: str, arguments: str = "", working_directory: str = None,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) -> int:
1763
1750
  if self.call_program_runner_directly:
1764
1751
  return self.program_runner.run_program_argsasarray_async(program, arguments, working_directory, custom_argument, interactive)
1765
- return self.run_program_argsasarray_async(program, GeneralUtilities.arguments_to_array(arguments), working_directory, verbosity, print_errors_as_information, log_file, timeoutInSeconds, addLogOverhead, title, log_namespace, arguments_for_log, custom_argument, interactive)
1752
+ return self.run_program_argsasarray_async(program, GeneralUtilities.arguments_to_array(arguments), working_directory, print_errors_as_information, log_file, timeoutInSeconds, addLogOverhead, title, log_namespace, arguments_for_log, custom_argument, interactive)
1766
1753
 
1767
1754
  @GeneralUtilities.check_arguments
1768
1755
  def __try_load_mock(self, program: str, arguments: str, working_directory: str) -> tuple[bool, tuple[int, str, str, int]]:
@@ -1841,6 +1828,13 @@ class ScriptCollectionCore:
1841
1828
  stderr: str
1842
1829
  pid: int
1843
1830
 
1831
+ @GeneralUtilities.check_arguments
1832
+ def run_with_epew(self, program: str, argument: str = "", working_directory: str = None, 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, throw_exception_if_exitcode_is_not_zero: bool = True, custom_argument: object = None, interactive: bool = False) -> tuple[int, str, str, int]:
1833
+ sc: ScriptCollectionCore = ScriptCollectionCore()
1834
+ sc.program_runner = ProgramRunnerEpew()
1835
+ return sc.run_program(program, argument, working_directory, print_errors_as_information, log_file, timeoutInSeconds, addLogOverhead, title, log_namespace, arguments_for_log, throw_exception_if_exitcode_is_not_zero, custom_argument, interactive)
1836
+
1837
+
1844
1838
  # </run programs>
1845
1839
 
1846
1840
  @GeneralUtilities.check_arguments
@@ -1920,8 +1914,8 @@ class ScriptCollectionCore:
1920
1914
  @GeneralUtilities.check_arguments
1921
1915
  def get_version_from_gitversion(self, folder: str, variable: str) -> str:
1922
1916
  # called twice as workaround for issue 1877 in gitversion ( https://github.com/GitTools/GitVersion/issues/1877 )
1923
- result = self.run_program_argsasarray("gitversion", ["/showVariable", variable], folder, verbosity=0)
1924
- result = self.run_program_argsasarray("gitversion", ["/showVariable", variable], folder, verbosity=0)
1917
+ result = self.run_program_argsasarray("gitversion", ["/showVariable", variable], folder)
1918
+ result = self.run_program_argsasarray("gitversion", ["/showVariable", variable], folder)
1925
1919
  result = GeneralUtilities.strip_new_line_character(result[1])
1926
1920
 
1927
1921
  return result
@@ -1984,7 +1978,7 @@ DNS = {domain}
1984
1978
  self.run_program_argsasarray("openssl", ['pkcs12', '-export', '-out', f'{filename}.pfx', f'-inkey', f'{filename}.key', '-in', f'{filename}.crt', '-password', f'pass:{password}'], folder)
1985
1979
 
1986
1980
  @GeneralUtilities.check_arguments
1987
- def update_dependencies_of_python_in_requirementstxt_file(self, file: str, ignored_dependencies: list[str], verbosity: int):
1981
+ def update_dependencies_of_python_in_requirementstxt_file(self, file: str, ignored_dependencies: list[str]):
1988
1982
  # TODO consider ignored_dependencies
1989
1983
  lines = GeneralUtilities.read_lines_from_file(file)
1990
1984
  new_lines = []
@@ -2015,7 +2009,7 @@ DNS = {domain}
2015
2009
  raise ValueError(f'Unexpected line in requirements-file: "{line}"')
2016
2010
 
2017
2011
  @GeneralUtilities.check_arguments
2018
- def update_dependencies_of_python_in_setupcfg_file(self, setup_cfg_file: str, ignored_dependencies: list[str], verbosity: int):
2012
+ def update_dependencies_of_python_in_setupcfg_file(self, setup_cfg_file: str, ignored_dependencies: list[str]):
2019
2013
  # TODO consider ignored_dependencies
2020
2014
  lines = GeneralUtilities.read_lines_from_file(setup_cfg_file)
2021
2015
  new_lines = []
@@ -2035,7 +2029,7 @@ DNS = {domain}
2035
2029
  GeneralUtilities.write_lines_to_file(setup_cfg_file, new_lines)
2036
2030
 
2037
2031
  @GeneralUtilities.check_arguments
2038
- def update_dependencies_of_dotnet_project(self, csproj_file: str, verbosity: int, ignored_dependencies: list[str]):
2032
+ def update_dependencies_of_dotnet_project(self, csproj_file: str, ignored_dependencies: list[str]):
2039
2033
  folder = os.path.dirname(csproj_file)
2040
2034
  csproj_filename = os.path.basename(csproj_file)
2041
2035
  self.log.log(f"Check for updates in {csproj_filename}", LogLevel.Information)
@@ -2050,7 +2044,7 @@ DNS = {domain}
2050
2044
  self.run_program_with_retry("dotnet", f"add {csproj_filename} package {package_name}", folder, print_errors_as_information=True)
2051
2045
 
2052
2046
  @GeneralUtilities.check_arguments
2053
- 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:
2047
+ def create_deb_package(self, toolname: str, binary_folder: str, control_file_content: str, deb_output_folder: str, permission_of_executable_file_as_octet_triple: int) -> None:
2054
2048
 
2055
2049
  # prepare
2056
2050
  GeneralUtilities.ensure_directory_exists(deb_output_folder)
@@ -2113,9 +2107,9 @@ chmod {permission} {link_file}
2113
2107
 
2114
2108
  # create debfile
2115
2109
  deb_filename = f"{toolname}.deb"
2116
- self.run_program_argsasarray("tar", ["czf", f"../{entireresult_content_folder_name}/control.tar.gz", "*"], packagecontent_control_folder, verbosity=verbosity)
2117
- self.run_program_argsasarray("tar", ["czf", f"../{entireresult_content_folder_name}/data.tar.gz", "*"], packagecontent_data_folder, verbosity=verbosity)
2118
- self.run_program_argsasarray("ar", ["r", deb_filename, "debian-binary", "control.tar.gz", "data.tar.gz"], packagecontent_entireresult_folder, verbosity=verbosity)
2110
+ self.run_program_argsasarray("tar", ["czf", f"../{entireresult_content_folder_name}/control.tar.gz", "*"], packagecontent_control_folder)
2111
+ self.run_program_argsasarray("tar", ["czf", f"../{entireresult_content_folder_name}/data.tar.gz", "*"], packagecontent_data_folder)
2112
+ self.run_program_argsasarray("ar", ["r", deb_filename, "debian-binary", "control.tar.gz", "data.tar.gz"], packagecontent_entireresult_folder)
2119
2113
  result_file = os.path.join(packagecontent_entireresult_folder, deb_filename)
2120
2114
  shutil.copy(result_file, os.path.join(deb_output_folder, deb_filename))
2121
2115
 
@@ -2358,10 +2352,10 @@ TXDX
2358
2352
  GeneralUtilities.write_text_to_file(file, ET.tostring(element, encoding="unicode"), encoding)
2359
2353
 
2360
2354
  @GeneralUtilities.check_arguments
2361
- def install_requirementstxt_file(self, requirements_txt_file: str, verbosity: int):
2355
+ def install_requirementstxt_file(self, requirements_txt_file: str):
2362
2356
  folder: str = os.path.dirname(requirements_txt_file)
2363
2357
  filename: str = os.path.basename(requirements_txt_file)
2364
- self.run_program_argsasarray("pip", ["install", "-r", filename], folder, verbosity=verbosity)
2358
+ self.run_program_argsasarray("pip", ["install", "-r", filename], folder)
2365
2359
 
2366
2360
  @GeneralUtilities.check_arguments
2367
2361
  def ocr_analysis_of_folder(self, folder: str, serviceaddress: str, extensions: list[str], languages: list[str]) -> list[str]: # Returns a list of changed files due to ocr-analysis.
@@ -2468,38 +2462,30 @@ OCR-content:
2468
2462
  self.log.log(f"Finished action \"{name_of_task}\".", LogLevel.Information)
2469
2463
 
2470
2464
  def get_lines_of_code_with_default_excluded_patterns(self, repository: str) -> int:
2471
- return self.get_lines_of_code(repository, self.default_excluded_patterns_for_loc, False)
2465
+ return self.get_lines_of_code(repository, self.default_excluded_patterns_for_loc)
2472
2466
 
2473
2467
  default_excluded_patterns_for_loc: list[str] = [".txt", ".md", ".vscode", "Resources", "Reference", ".gitignore", ".gitattributes", "Other/Metrics"]
2474
2468
 
2475
- def get_lines_of_code(self, repository: str, excluded_pattern: list[str], verbose: bool) -> int:
2469
+ def get_lines_of_code(self, repository: str, excluded_pattern: list[str]) -> int:
2476
2470
  self.assert_is_git_repository(repository)
2477
2471
  result: int = 0
2478
- if verbose:
2479
- GeneralUtilities.write_message_to_stdout(f"Calculate lines of code in repository '{repository}' with excluded patterns: {', '.join(excluded_pattern)}")
2472
+ self.log.log(f"Calculate lines of code in repository '{repository}' with excluded patterns: {', '.join(excluded_pattern)}")
2480
2473
  git_response = self.run_program("git", "ls-files", repository)
2481
2474
  files: list[str] = GeneralUtilities.string_to_lines(git_response[1])
2482
- very_verbose: bool = False
2483
- if very_verbose:
2484
- verbose = True
2485
2475
  for file in files:
2486
2476
  if os.path.isfile(os.path.join(repository, file)):
2487
2477
  if self.__is_excluded_by_glob_pattern(file, excluded_pattern):
2488
- if very_verbose:
2489
- GeneralUtilities.write_message_to_stdout(f"File '{file}' is ignored because it matches an excluded pattern.")
2478
+ self.log.log(f"File '{file}' is ignored because it matches an excluded pattern.",LogLevel.Diagnostic)
2490
2479
  else:
2491
2480
  full_file: str = os.path.join(repository, file)
2492
2481
  if GeneralUtilities.is_binary_file(full_file):
2493
- if very_verbose:
2494
- GeneralUtilities.write_message_to_stdout(f"File '{file}' is ignored because it is a binary-file.")
2482
+ self.log.log(f"File '{file}' is ignored because it is a binary-file.",LogLevel.Diagnostic)
2495
2483
  else:
2496
- if verbose:
2497
- GeneralUtilities.write_message_to_stdout(f"Count lines of file '{file}'.")
2484
+ self.log.log(f"Count lines of file '{file}'.",LogLevel.Diagnostic)
2498
2485
  length = len(GeneralUtilities.read_nonempty_lines_from_file(full_file))
2499
2486
  result = result+length
2500
2487
  else:
2501
- if verbose:
2502
- GeneralUtilities.write_message_to_stdout(f"File '{file}' is ignored because it does not exist.")
2488
+ self.log.log(f"File '{file}' is ignored because it does not exist.",LogLevel.Diagnostic)
2503
2489
  return result
2504
2490
 
2505
2491
  def __is_excluded_by_glob_pattern(self, file: str, excluded_patterns: list[str]) -> bool: