ScriptCollection 4.4.49__py3-none-any.whl → 4.4.50__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.
@@ -697,14 +697,22 @@ class GeneralUtilities:
697
697
  @staticmethod
698
698
  @check_arguments
699
699
  def ensure_directory_does_not_exist(path: str) -> None:
700
- if (os.path.isdir(path)):
700
+ # Symbolic links are removed themselves without changing permissions, because os.chmod follows them and would change the permissions of their targets outside of the folder.
701
+ if os.path.islink(path):
702
+ os.unlink(path)
703
+ elif (os.path.isdir(path)):
701
704
  for root, dirs, files in os.walk(path, topdown=False):
702
705
  for name in files:
703
706
  filename = os.path.join(root, name)
704
- os.chmod(filename, stat.S_IWUSR)
707
+ if not os.path.islink(filename):
708
+ os.chmod(filename, stat.S_IWUSR)
705
709
  os.remove(filename)
706
710
  for name in dirs:
707
- GeneralUtilities.__rmtree(os.path.join(root, name))
711
+ folder = os.path.join(root, name)
712
+ if os.path.islink(folder):
713
+ os.unlink(folder)
714
+ else:
715
+ GeneralUtilities.__rmtree(folder)
708
716
  GeneralUtilities.__rmtree(path)
709
717
 
710
718
  @staticmethod
@@ -1324,7 +1332,7 @@ class GeneralUtilities:
1324
1332
  def replace_variable(prefix:str, variable_name:str, suffix:str, value:str, content: str) -> str:
1325
1333
  GeneralUtilities.assert_condition(not "__" in variable_name, f"'{variable_name}' is an invalid variable name because it contains '__' which is treated as control-sequence.")
1326
1334
  pattern = re.escape(GeneralUtilities.str_none_safe( prefix)) + r"\s*" +"__"+ re.escape(variable_name) + "__"+r"\s*" + re.escape(GeneralUtilities.str_none_safe( suffix))
1327
- result:str= re.sub(pattern, value, content)
1335
+ result:str= re.sub(pattern, lambda _: value, content)
1328
1336
  GeneralUtilities.assert_condition(not f"__{variable_name}__" in result, f"Variable '{variable_name}' was not replaced in the content. This is likely caused by an error in the content or the variable name.")
1329
1337
  return result
1330
1338
 
@@ -28,16 +28,13 @@ class ProcessesRunner:
28
28
  def run(self):
29
29
  pids: list[int] = list[int]()
30
30
  for processstartinfo in self.processes:
31
- pids.append(self.sc.run_program_async(processstartinfo.program, processstartinfo.argumentss, processstartinfo.workingdirectory))
31
+ pids.append(self.sc.run_program_async(processstartinfo.program, processstartinfo.arguments, processstartinfo.workingdirectory))
32
32
  enabled = True
33
33
  while enabled:
34
34
  for pid in pids:
35
35
  if not psutil.pid_exists(pid):
36
36
  enabled = False
37
37
  # one program terminated so exit and terminate all now
38
- processes = psutil.process_iter()
39
38
  for pid in pids:
40
39
  if psutil.pid_exists(pid):
41
- for proc in processes:
42
- if proc.pid == pid:
43
- proc.kill()
40
+ psutil.Process(pid).kill()
@@ -40,7 +40,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
40
40
  from .ProgramRunnerPopen import ProgramRunnerPopen
41
41
  from .SCLog import SCLog, LogLevel
42
42
 
43
- version = "4.4.49"
43
+ version = "4.4.50"
44
44
  __version__ = version
45
45
 
46
46
  class VSCodeWorkspaceShellTask:
@@ -452,7 +452,7 @@ class ScriptCollectionCore:
452
452
  if not (image in images):
453
453
  return False
454
454
 
455
- if self.get_tags_of_images_from_registry(registry_url,image,registry_username,registry_password)<1:
455
+ if len(self.__get_tags_of_image_from_registry(registry_url,image,registry_username,registry_password))<1:
456
456
  return False
457
457
 
458
458
  return True
@@ -491,6 +491,9 @@ class ScriptCollectionCore:
491
491
  image=image.rsplit("/", 1)[-1]
492
492
  if not self.registry_contains_image(registry_base_url,image,registry_username,registry_password):
493
493
  return []
494
+ return self.__get_tags_of_image_from_registry(registry_base_url,image,registry_username,registry_password)
495
+
496
+ def __get_tags_of_image_from_registry(self,registry_base_url:str,image:str,registry_username:str,registry_password:str)->list[str]:
494
497
  tags_url = f"{registry_base_url}/v2/{image}/tags/list"
495
498
  response = requests.get(tags_url, auth=(registry_username, registry_password),timeout=20)
496
499
  response.raise_for_status() # check if statuscode = 200
@@ -518,6 +521,12 @@ class ScriptCollectionCore:
518
521
  message = str(exception).lower()
519
522
  return any(indicator in message for indicator in ScriptCollectionCore.__timeout_error_indicators)
520
523
 
524
+ @GeneralUtilities.check_arguments
525
+ def __run_openssl(self, arguments: list[str], folder: str) -> None:
526
+ # Passwords are passed to openssl as "pass:<password>", so they are masked for the log and for the message of an exception.
527
+ arguments_for_log = ["pass:***" if argument.startswith("pass:") else argument for argument in arguments]
528
+ self.run_program_argsasarray("openssl", arguments, folder, arguments_for_log=arguments_for_log)
529
+
521
530
  @GeneralUtilities.check_arguments
522
531
  def docker_login(self, registry: str, username: str, password: str) -> None:
523
532
  """Logs in to the given docker-registry."""
@@ -747,9 +756,11 @@ class ScriptCollectionCore:
747
756
  nupkg_file_name = os.path.basename(nupkg_file)
748
757
  nupkg_file_folder = os.path.dirname(nupkg_file)
749
758
  argument = f"nuget push {nupkg_file_name} --force-english-output --source {registry_address}"
759
+ argument_for_log = argument
750
760
  if api_key is not None:
751
- argument = f"{argument} --api-key {api_key}"
752
- self.run_program("dotnet", argument, nupkg_file_folder)
761
+ argument = f"{argument} --api-key {api_key}"
762
+ argument_for_log = f"{argument_for_log} --api-key ***"
763
+ self.run_program("dotnet", argument, nupkg_file_folder, arguments_for_log=argument_for_log)
753
764
 
754
765
  @GeneralUtilities.check_arguments
755
766
  def dotnet_build(self, folder: str, projectname: str, configuration: str):
@@ -787,10 +798,12 @@ class ScriptCollectionCore:
787
798
  result = self.run_program("git", f"verify-commit {revision_identifier}", repository_folder, throw_exception_if_exitcode_is_not_zero=False)
788
799
  if (result[0] != 0):
789
800
  return False
790
- if (not GeneralUtilities.contains_line(result[1].splitlines(), f"gpg\\:\\ using\\ [A-Za-z0-9]+\\ key\\ [A-Za-z0-9]+{key}")):
801
+ # "git verify-commit" writes the output of gpg to stderr.
802
+ gpg_output_lines = result[2].splitlines()
803
+ if (not GeneralUtilities.contains_line(gpg_output_lines, f"gpg\\:\\ using\\ [A-Za-z0-9]+\\ key\\ [A-Za-z0-9]+{re.escape(key)}")):
791
804
  # TODO check whether this works on machines where gpg is installed in another language than english
792
805
  return False
793
- if (not GeneralUtilities.contains_line(result[1].splitlines(), "gpg\\:\\ Good\\ signature\\ from")):
806
+ if (not GeneralUtilities.contains_line(gpg_output_lines, "gpg\\:\\ Good\\ signature\\ from")):
794
807
  # TODO check whether this works on machines where gpg is installed in another language than english
795
808
  return False
796
809
  return True
@@ -798,7 +811,7 @@ class ScriptCollectionCore:
798
811
  @GeneralUtilities.check_arguments
799
812
  def get_parent_commit_ids_of_commit(self, repository_folder: str, commit_id: str) -> str:
800
813
  self.is_git_or_bare_git_repository(repository_folder)
801
- 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(" ")
814
+ return self.run_program_argsasarray("git", ["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(" ")
802
815
 
803
816
 
804
817
  @GeneralUtilities.check_arguments
@@ -806,7 +819,7 @@ class ScriptCollectionCore:
806
819
  self.is_git_or_bare_git_repository(repository_folder)
807
820
  since_as_string = self.__datetime_to_string_for_git(since)
808
821
  until_as_string = self.__datetime_to_string_for_git(until)
809
- 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))
822
+ result = filter(lambda line: not GeneralUtilities.string_is_none_or_whitespace(line), self.run_program_argsasarray("git", ["log", f"--since={since_as_string}", f"--until={until_as_string}", "--pretty=format:%H", "--no-patch"], repository_folder, throw_exception_if_exitcode_is_not_zero=True)[1].replace("\r", GeneralUtilities.empty_string).split("\n"))
810
823
  if ignore_commits_which_are_not_in_history_of_head:
811
824
  result = [commit_id for commit_id in result if self.git_commit_is_ancestor(repository_folder, commit_id)]
812
825
  return result
@@ -968,7 +981,7 @@ class ScriptCollectionCore:
968
981
 
969
982
  @GeneralUtilities.check_arguments
970
983
  def git_pull_with_retry(self, folder: str, remote: str, localbranchname: str, remotebranchname: str, force: bool = False, amount_of_attempts: int = 5) -> None:
971
- GeneralUtilities.retry_action(lambda: self.git_pull(folder, remote, localbranchname, remotebranchname), amount_of_attempts)
984
+ GeneralUtilities.retry_action(lambda: self.git_pull(folder, remote, localbranchname, remotebranchname, force), amount_of_attempts)
972
985
 
973
986
  @GeneralUtilities.check_arguments
974
987
  def git_branch_is_pullable(self, folder: str, remote: str, localbranchname: str, remotebranchname: str) -> bool:
@@ -1049,7 +1062,7 @@ class ScriptCollectionCore:
1049
1062
  def git_add_or_set_remote_address(self, directory: str, remote_name: str, remote_address: str) -> None:
1050
1063
  self.assert_is_git_repository(directory)
1051
1064
  if (self.repository_has_remote_with_specific_name(directory, remote_name)):
1052
- self.run_program_argsasarray("git", ['remote', 'set-url', 'remote_name', remote_address], directory, throw_exception_if_exitcode_is_not_zero=True)
1065
+ self.run_program_argsasarray("git", ['remote', 'set-url', remote_name, remote_address], directory, throw_exception_if_exitcode_is_not_zero=True)
1053
1066
  else:
1054
1067
  self.run_program_argsasarray("git", ['remote', 'add', remote_name, remote_address], directory, throw_exception_if_exitcode_is_not_zero=True)
1055
1068
 
@@ -1098,7 +1111,7 @@ class ScriptCollectionCore:
1098
1111
  if commit_message_body is not None:
1099
1112
  argument.extend(['--message', commit_message_body])
1100
1113
  if (GeneralUtilities.string_has_content(author_name)):
1101
- argument.append(f'--author="{author_name} <{author_email}>"')
1114
+ argument.append(f'--author={author_name} <{author_email}>')
1102
1115
  git_repository_has_uncommitted_changes = self.git_repository_has_uncommitted_changes(directory)
1103
1116
 
1104
1117
  if git_repository_has_uncommitted_changes:
@@ -1125,14 +1138,13 @@ class ScriptCollectionCore:
1125
1138
 
1126
1139
  def search_repository_folder(self,some_file_in_repository:str)->str:
1127
1140
  current_path:str=os.path.dirname(some_file_in_repository)
1128
- enabled:bool=True
1129
- while enabled:
1130
- try:
1131
- current_path=GeneralUtilities.resolve_relative_path("..",current_path)
1132
- if self.is_git_repository(current_path):
1133
- return current_path
1134
- except:
1135
- enabled=False
1141
+ while True:
1142
+ if self.is_git_repository(current_path):
1143
+ return current_path
1144
+ parent_path:str=GeneralUtilities.resolve_relative_path("..",current_path)
1145
+ if parent_path==current_path:
1146
+ break
1147
+ current_path=parent_path
1136
1148
  raise ValueError(f"Can not find git-repository for folder \"{some_file_in_repository}\".")
1137
1149
 
1138
1150
 
@@ -1213,9 +1225,9 @@ class ScriptCollectionCore:
1213
1225
  if self.is_git_repository(subfolder):
1214
1226
  source_repository = subfolder
1215
1227
  target_repository = os.path.join(target_directory, foldername)
1216
- if os.path.isdir(target_directory):
1228
+ if os.path.isdir(target_repository):
1217
1229
  # fetch
1218
- self.git_fetch(target_directory)
1230
+ self.git_fetch(target_repository)
1219
1231
  else:
1220
1232
  # clone
1221
1233
  self.git_clone(target_repository, source_repository, include_submodules=True, mirror=True)
@@ -2238,8 +2250,8 @@ resolving a name requires fontconfig, which does not exist on every system ffmpe
2238
2250
  for root, _, files in os.walk(folder):
2239
2251
  for file in files:
2240
2252
  full_path = os.path.join(root, file)
2241
- with (open(full_path, "rb").read()) as text_io_wrapper:
2242
- content = text_io_wrapper
2253
+ with open(full_path, "rb") as file_stream:
2254
+ content = file_stream.read()
2243
2255
  path_in_iso = '/' + files_directory + \
2244
2256
  self.__adjust_folder_name(full_path[len(folder)::1]).upper()
2245
2257
  if path_in_iso not in created_directories:
@@ -2345,7 +2357,7 @@ resolving a name requires fontconfig, which does not exist on every system ffmpe
2345
2357
  #docker run --rm -it debian bash -c "apt update && apt list -a tor"
2346
2358
  image_address, image_tag = ScriptCollectionCore.split_image_address_and_tag(image)
2347
2359
  self.docker_pull(image_address, image_tag)
2348
- output=self.run_with_epew("docker", f"run --rm -it {image} bash -c \"apt --color=false update && apt --color=false list -a tor\"",os.getcwd(),encode_argument_in_base64=True)
2360
+ output=self.run_with_epew("docker", f"run --rm -it {image} bash -c \"apt --color=false update && apt --color=false list -a {package}\"",os.getcwd(),encode_argument_in_base64=True)
2349
2361
  stdout=output[1]
2350
2362
  version_lines=[line.strip() for line in GeneralUtilities.string_to_lines(stdout) if GeneralUtilities.string_has_nonwhitespace_content(line) and line.startswith(package+"/")]
2351
2363
  GeneralUtilities.assert_condition(0<len(version_lines), f"No version found for package '{package}' in image '{image}'.")
@@ -2428,7 +2440,8 @@ resolving a name requires fontconfig, which does not exist on every system ffmpe
2428
2440
 
2429
2441
  @GeneralUtilities.check_arguments
2430
2442
  def __get_file_permission_helper(self, permissions: str) -> str:
2431
- return str(self.__to_octet(permissions[0:3])) + str(self.__to_octet(permissions[3:6]))+str(self.__to_octet(permissions[6:9]))
2443
+ # The first character of the output of "ls -ld" is the file-type, so the permission-triples start at index 1.
2444
+ return str(self.__to_octet(permissions[1:4])) + str(self.__to_octet(permissions[4:7]))+str(self.__to_octet(permissions[7:10]))
2432
2445
 
2433
2446
  @GeneralUtilities.check_arguments
2434
2447
  def __to_octet(self, string: str) -> int:
@@ -2497,7 +2510,7 @@ resolving a name requires fontconfig, which does not exist on every system ffmpe
2497
2510
  args = []
2498
2511
  if recursive:
2499
2512
  args.append("--recursive")
2500
- if follow_symlinks:
2513
+ if not follow_symlinks:
2501
2514
  args.append("--no-dereference")
2502
2515
  args.append(owner)
2503
2516
  args.append(file_or_folder)
@@ -2778,8 +2791,10 @@ resolving a name requires fontconfig, which does not exist on every system ffmpe
2778
2791
  resolved_actual_folder = GeneralUtilities.resolve_relative_path(actual_folder, resolved_base_folder)
2779
2792
  if not self.path_is_allowed_within_base_folder(actual_folder, base_folder, excluded_folders):
2780
2793
  raise ValueError(f"The folder '{resolved_actual_folder}' is not allowed: it must be equal to or a subfolder of the base-folder '{resolved_base_folder}' and must not be located inside one of the excluded folders.")
2781
- effective_arguments = arguments.replace(ScriptCollectionCore.run_command_in_folder_actual_folder_placeholder, resolved_actual_folder)
2782
- result = self.run_program(command, effective_arguments, resolved_base_folder,print_live_output=True)
2794
+ # The arguments are split before the placeholder is replaced, so that actual_folder always stays exactly one argument.
2795
+ # Otherwise an actual_folder which contains spaces could inject further arguments which were not checked.
2796
+ effective_arguments = [argument.replace(ScriptCollectionCore.run_command_in_folder_actual_folder_placeholder, resolved_actual_folder) for argument in GeneralUtilities.arguments_to_array(arguments)]
2797
+ result = self.run_program_argsasarray(command, effective_arguments, resolved_base_folder, print_live_output=True)
2783
2798
  return result[0]
2784
2799
 
2785
2800
  # Return-values program_runner: Exitcode, StdOut, StdErr, Pid
@@ -2912,12 +2927,16 @@ resolving a name requires fontconfig, which does not exist on every system ffmpe
2912
2927
  password_set = not password is None
2913
2928
  file_name = Path(zip_file).name
2914
2929
  file_folder = os.path.dirname(zip_file)
2915
- argument = "x"
2930
+ arguments = ["x"]
2931
+ arguments_for_log = ["x"]
2916
2932
  if password_set:
2917
- argument = f"{argument} -p\"{password}\""
2918
- argument = f"{argument} -o {output_directory}"
2919
- argument = f"{argument} {file_name}"
2920
- return self.run_program(unzip_program_file, argument, file_folder)
2933
+ arguments.append(f"-p{password}")
2934
+ arguments_for_log.append("-p***")
2935
+ arguments.append(f"-o{output_directory}")
2936
+ arguments.append(file_name)
2937
+ arguments_for_log.append(f"-o{output_directory}")
2938
+ arguments_for_log.append(file_name)
2939
+ return self.run_program_argsasarray(unzip_program_file, arguments, file_folder, arguments_for_log=arguments_for_log)
2921
2940
 
2922
2941
  @GeneralUtilities.check_arguments
2923
2942
  def get_internet_time(self) -> datetime:
@@ -3116,7 +3135,7 @@ resolving a name requires fontconfig, which does not exist on every system ffmpe
3116
3135
  if password is None:
3117
3136
  password = GeneralUtilities.generate_password()
3118
3137
  GeneralUtilities.ensure_directory_exists(folder)
3119
- self.run_program_argsasarray("openssl", ['req', '-new', '-newkey', 'ec', '-pkeyopt', 'ec_paramgen_curve:prime256v1', '-days', str(days_until_expire), '-nodes', '-x509', '-subj', f'/C={subj_c}/ST={subj_st}/L={subj_l}/O={subj_o}/CN={name}/OU={subj_ou}', '-passout', f'pass:{password}', '-keyout', f'{name}.key', '-out', f'{name}.crt'], folder)
3138
+ self.__run_openssl(['req', '-new', '-newkey', 'ec', '-pkeyopt', 'ec_paramgen_curve:prime256v1', '-days', str(days_until_expire), '-nodes', '-x509', '-subj', f'/C={subj_c}/ST={subj_st}/L={subj_l}/O={subj_o}/CN={name}/OU={subj_ou}', '-passout', f'pass:{password}', '-keyout', f'{name}.key', '-out', f'{name}.crt'], folder)
3120
3139
 
3121
3140
  @GeneralUtilities.check_arguments
3122
3141
  def generate_certificate(self, folder: str, domain: str, filename: str, subj_c: str, subj_st: str, subj_l: str, subj_o: str, subj_ou: str, days_until_expire: int = None, password: str = None) -> None:
@@ -3133,7 +3152,7 @@ resolving a name requires fontconfig, which does not exist on every system ffmpe
3133
3152
  rsa_key_length = 4096
3134
3153
  self.run_program_argsasarray("openssl", ['genrsa', '-out', f'{filename}.key', f'{rsa_key_length}'], folder)
3135
3154
  self.run_program_argsasarray("openssl", ['req', '-new', '-subj', f'/C={subj_c}/ST={subj_st}/L={subj_l}/O={subj_o}/CN={domain}/OU={subj_ou}', '-x509', '-key', f'{filename}.key', '-out', f'{filename}.unsigned.crt', '-days', f'{days_until_expire}'], folder)
3136
- self.run_program_argsasarray("openssl", ['pkcs12', '-export', '-out', f'{filename}.selfsigned.pfx', '-password', f'pass:{password}', '-inkey', f'{filename}.key', '-in', f'{filename}.unsigned.crt'], folder)
3155
+ self.__run_openssl(['pkcs12', '-export', '-out', f'{filename}.selfsigned.pfx', '-password', f'pass:{password}', '-inkey', f'{filename}.key', '-in', f'{filename}.unsigned.crt'], folder)
3137
3156
  GeneralUtilities.write_text_to_file(os.path.join(folder, f"{filename}.password"), password)
3138
3157
  GeneralUtilities.write_text_to_file(os.path.join(folder, f"{filename}.san.conf"), f"""[ req ]
3139
3158
  default_bits = {rsa_key_length}
@@ -3170,7 +3189,7 @@ DNS = {domain}
3170
3189
  password_file = os.path.join(folder, f"{filename}.password")
3171
3190
  password = GeneralUtilities.read_text_from_file(password_file)
3172
3191
  self.run_program_argsasarray("openssl", ['x509', '-req', '-in', f'{filename}.csr', '-CA', f'{ca}.crt', '-CAkey', f'{ca}.key', '-CAcreateserial', '-CAserial', f'{ca}.srl', '-out', f'{filename}.crt', '-days', str(days_until_expire), '-sha256', '-extensions', 'v3_req', '-extfile', f'{filename}.san.conf'], folder)
3173
- 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)
3192
+ self.__run_openssl(['pkcs12', '-export', '-out', f'{filename}.pfx', f'-inkey', f'{filename}.key', '-in', f'{filename}.crt', '-password', f'pass:{password}'], folder)
3174
3193
 
3175
3194
  @GeneralUtilities.check_arguments
3176
3195
  def update_dependencies_of_python_in_requirementstxt_file(self, file: str, ignored_dependencies: list[str]):
@@ -3387,7 +3406,6 @@ chmod {permission} {link_file}
3387
3406
 
3388
3407
  @GeneralUtilities.check_arguments
3389
3408
  def generate_arc42_reference_template(self, repository: str, productname: str = None, subfolder: str = None):
3390
- productname: str = None
3391
3409
  if productname is None:
3392
3410
  productname = os.path.basename(repository)
3393
3411
  if subfolder is None:
@@ -4453,7 +4471,7 @@ OCR-content:
4453
4471
  command_with_args = command
4454
4472
  if "args" in task:
4455
4473
  args = task["args"]
4456
- if len(args) > 1:
4474
+ if len(args) > 0:
4457
4475
  command_with_args = f"{command_with_args} {' '.join(args)}"
4458
4476
 
4459
4477
  description: str =None
@@ -4790,7 +4808,7 @@ OCR-content:
4790
4808
  language_files_with_content:dict[str,ET.ElementTree]=dict()
4791
4809
  for language_file in language_files_list:
4792
4810
  GeneralUtilities.assert_file_exists(language_file)
4793
- GeneralUtilities.assert_condition(self.is_xliff2_file(language_file), f"The base file '{base_file}' is not a valid XLIFF 2.0 file.")
4811
+ GeneralUtilities.assert_condition(self.is_xliff2_file(language_file), f"The language file '{language_file}' is not a valid XLIFF 2.0 file.")
4794
4812
  language_files_with_content[language_file]=ET.parse(language_file)
4795
4813
 
4796
4814
  #sync existing files
@@ -4936,7 +4954,7 @@ OCR-content:
4936
4954
 
4937
4955
  @GeneralUtilities.check_arguments
4938
4956
  def write_commit_list_for_repository(self,repository_folder:str,target_file:str,include_all_heads:bool=False) -> None:
4939
- if os.path.isabs(target_file):
4957
+ if not os.path.isabs(target_file):
4940
4958
  target_file=GeneralUtilities.resolve_relative_path(target_file,repository_folder)
4941
4959
  target_file=GeneralUtilities.normalize_path(target_file)
4942
4960
  commits=self.get_all_commits_in_git_repository(repository_folder, include_all_heads)
@@ -67,7 +67,7 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
67
67
  arguments.append("--store-password-in-clear-text")
68
68
  arguments_for_log = list(arguments)
69
69
  if package_source.has_credentials():
70
- arguments_for_log[arguments_for_log.index(package_source.password)] = "***"#the password must not be written to the build-log
70
+ arguments_for_log[arguments_for_log.index("--password")+1] = "***"#the password must not be written to the build-log
71
71
  self._protected_sc.log.log(f"Add NuGet-source \"{package_source.name}\" ({package_source.url})..." if name_of_source_with_same_url is None else f"Update the already registered NuGet-source \"{name_of_source_with_same_url}\" ({package_source.url})...", LogLevel.Debug)
72
72
  self._protected_sc.run_program_argsasarray("dotnet", arguments, codeunit_folder, arguments_for_log=arguments_for_log, print_live_output=False, env_vars=self.__dotnet_cli_environment_variables)
73
73
 
@@ -1,6 +1,7 @@
1
1
  import os
2
2
  import json
3
3
  import base64
4
+ import hmac
4
5
  import shutil
5
6
  import ssl
6
7
  import time
@@ -339,7 +340,7 @@ class SCTaskRunnerServer:
339
340
  except Exception:
340
341
  return False
341
342
  expected = f"{outer._SCTaskRunnerServer__username}:{outer._SCTaskRunnerServer__password}"
342
- return decoded == expected
343
+ return hmac.compare_digest(decoded.encode("utf-8"), expected.encode("utf-8"))
343
344
 
344
345
  def __send(self, status: int, body: bytes, content_type: str = "application/octet-stream") -> None:
345
346
  self.__answer_was_begun = True
@@ -1735,8 +1735,9 @@ class TFCPS_Tools_General:
1735
1735
  verbose_argument = GeneralUtilities.empty_string
1736
1736
 
1737
1737
  twine_argument = f"upload{gpg_identity_argument} --repository {repository} --non-interactive {filename} --disable-progress-bar"
1738
- twine_argument = f"{twine_argument} --username __token__ --password {api_key}{verbose_argument}"
1739
- self.__sc.run_program("twine", twine_argument, folder, throw_exception_if_exitcode_is_not_zero=True)
1738
+ twine_argument = f"{twine_argument}{verbose_argument}"
1739
+ # The credentials are passed as environment-variables and not as arguments, because the arguments are written to the log and to the message of the exception when the upload fails.
1740
+ self.__sc.run_program("twine", twine_argument, folder, throw_exception_if_exitcode_is_not_zero=True, env_vars={"TWINE_USERNAME": "__token__", "TWINE_PASSWORD": api_key})
1740
1741
 
1741
1742
  @GeneralUtilities.check_arguments
1742
1743
  def push_nuget_build_artifact(self, push_script_file: str, repository_folder_name: str, codeunitname: str, registry_address: str,api_key: str):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scriptcollection
3
- Version: 4.4.49
3
+ Version: 4.4.50
4
4
  Summary: The ScriptCollection is the place for reusable scripts.
5
5
  Author-email: Marius Göcke <marius.goecke@gmail.com>
6
6
  License-Expression: GPL-3.0-only
@@ -33,11 +33,11 @@ Requires-Dist: lxml>=6.0.1
33
33
  Requires-Dist: ntplib>=0.4.0
34
34
  Requires-Dist: Pillow>=11.3.0
35
35
  Requires-Dist: psutil>=7.2.2
36
- Requires-Dist: pycdlib>=1.21.0
36
+ Requires-Dist: pycdlib>=1.22.0
37
37
  Requires-Dist: Pygments>=2.21.0
38
38
  Requires-Dist: pylint>=4.1.2
39
39
  Requires-Dist: pyOpenSSL>=25.3.0
40
- Requires-Dist: PyPDF>=6.19.0
40
+ Requires-Dist: PyPDF>=6.20.0
41
41
  Requires-Dist: pytest>=8.4.2
42
42
  Requires-Dist: PyYAML>=6.0.3
43
43
  Requires-Dist: qrcode>=8.2.0
@@ -1,9 +1,9 @@
1
1
  ScriptCollection/ArbTranslationsOrganizer.py,sha256=3TO4fjkYADcHGyUXdiQk-RtfCxtf9ojuBS3CbZtgXBE,12218
2
2
  ScriptCollection/CertificateUpdater.py,sha256=yZc7KESc1F_Mc6HP2UfLmNHRc2MvtVqp0t60J_CqY3s,9755
3
3
  ScriptCollection/Executables.py,sha256=YczSDzT4HEV9aTlYGuk6TIjQSwHMsg2MKZ9SVncOfsY,74857
4
- ScriptCollection/GeneralUtilities.py,sha256=nNpLKKQO_vPoSw-kL_Pj15Hypm0cq1Y64UAPn3aVsoo,73443
4
+ ScriptCollection/GeneralUtilities.py,sha256=2Sf7H0cEdhvjY5gmi4QN-isasufHVIb9KltXKfxt7e4,73909
5
5
  ScriptCollection/HTTPMaintenanceOverheadHelper.py,sha256=TToNtyO1XzsMbBsTBf3o0xgOK0v4Jf03qw2Z0xb2nCk,2007
6
- ScriptCollection/ProcessesRunner.py,sha256=EYW927zu3QGmkCoHoYLkofmQZd7Tt1RIyVuhP3UYGho,1496
6
+ ScriptCollection/ProcessesRunner.py,sha256=wtNFdmj9klETTIDUSE90vaR5ClEX4V7dgJNVbp9_wi0,1381
7
7
  ScriptCollection/ProgramRunnerBase.py,sha256=eZenpiIFW1dhvSVCG7cfBs5hO4_KLlOxR7oXoSxUDmk,2286
8
8
  ScriptCollection/ProgramRunnerMock.py,sha256=uTu-aFle1W_oKjeQEmuPsFPQpvo0kRf2FrRjAPIwT5Y,37
9
9
  ScriptCollection/ProgramRunnerPopen.py,sha256=swRlWMQ3WiAkF3PTerraXU-LAAIdyvKbpW1CrQmee38,6497
@@ -11,7 +11,7 @@ ScriptCollection/ProgramRunnerSudo.py,sha256=vwKq-MOcqsgiKhSf-MBUDBC_UyaU8evP3Ro
11
11
  ScriptCollection/RepositoryDiagramGenerator.py,sha256=K_u2NW_p4ozdWD50irJEkkcDVa70TcUJpZN63TeXSLw,7092
12
12
  ScriptCollection/RepositoryHistoryAnalyzer.py,sha256=u9141B9D-Kef-9uo3yR7BXKUMzIKLVsesnYk7H-cWm4,6157
13
13
  ScriptCollection/SCLog.py,sha256=Fjf8Pdi63cXHGMxL_aI6A0dwGm7QIfrv3czjvpSUlaM,4705
14
- ScriptCollection/ScriptCollectionCore.py,sha256=38vEcGi5cTq2rXmXhbdxbPXKU5xeYwWQoiBu96WfdFs,309054
14
+ ScriptCollection/ScriptCollectionCore.py,sha256=iayhPdc1kZFbxs7cAltqP30RdQ_eN0ki3QhPi5B19fU,310633
15
15
  ScriptCollection/TestKind.py,sha256=jqLJwNvQeyea7SZf-UFzMC9pM0znv4do7FIC1xq8u9M,1672
16
16
  ScriptCollection/UnassignedVariablesCheck.py,sha256=8xNcp1D5HeOLO1a1NEerq2TsnpFhw7yzYPkaay-oisY,3804
17
17
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -34,7 +34,7 @@ ScriptCollection/TFCPS/NpmDependencies.py,sha256=IfUh9EyrkHxovGRWYagNMZjBUXyKjZ4
34
34
  ScriptCollection/TFCPS/PackageSource.py,sha256=tQoMbxrIbV3mYHKH2wgOoGzIHY1TvBH8EAFpWGhryrQ,1311
35
35
  ScriptCollection/TFCPS/PlantUMLRenderer.py,sha256=upnafiGKV-SdRI8iRBkbbWHN2u6v9KxoswdKi12AwoY,11060
36
36
  ScriptCollection/TFCPS/PubDependencies.py,sha256=hl6BfYjzb0-esO-pqyV_sxBLbHBi55GEgUiub3lma_8,9922
37
- ScriptCollection/TFCPS/SCTaskRunnerServer.py,sha256=tub8_1QBu0nWAaGnBWp2nErOW-SOHf_UL6qjOSGbnxU,31026
37
+ ScriptCollection/TFCPS/SCTaskRunnerServer.py,sha256=mmtpxrFn36GlW9ZdmEb_oigsQZBqJ85awJb9BOP3tGI,31089
38
38
  ScriptCollection/TFCPS/TFCPS_BuildCodeUnitsHook.py,sha256=67_DQwoH5bhxxSmwtuAeoW1NOCMiLMzOy48OqlJX-KY,1744
39
39
  ScriptCollection/TFCPS/TFCPS_CodeSpellCheck.py,sha256=zV62O7UiGjewx1yQUIWmUJ9D-5ipkV_f28uNhp-JWUs,5306
40
40
  ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=yosafTfbB0LBMKomZvLnFJpgJpJOMHsGKLirVjG1slk,40501
@@ -47,7 +47,7 @@ ScriptCollection/TFCPS/TFCPS_MergeToStable.py,sha256=oYEhz5ZWMnbu97_CcYEqdDxakUF
47
47
  ScriptCollection/TFCPS/TFCPS_OCIImageSecretScan.py,sha256=Jb7AaMcJDW-gYEYBUVZAG3QLTTNWmXlvVEW-lZsykws,14821
48
48
  ScriptCollection/TFCPS/TFCPS_PreBuildCodeunitsScript.py,sha256=XLVsFTA1jvfDbZ7wYJgIdEByZhF_bYVbA5jkisuvK4k,2322
49
49
  ScriptCollection/TFCPS/TFCPS_RemoteBuild.py,sha256=2Tx5HLk1ZftBWDCTiGZdP2QiiGNyWsEuTCSt33dNQjc,23891
50
- ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=5dvRL-QWxLuGbT68qLMQMmnhPNoVbDIU7pAQpPAt9Oo,157277
50
+ ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=SxIgDq1-Z9X7msyJurhHXcZy8vL0Fy60WqkApvP7Xlk,157492
51
51
  ScriptCollection/TFCPS/TFCPS_VisualRegressionTests.py,sha256=6_63udxHnPlu_TMk_ftLZTnzriJO8MCxVCVAsweZqHs,37073
52
52
  ScriptCollection/TFCPS/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
53
  ScriptCollection/TFCPS/CPP/TFCPS_CodeUnitSpecific_CPP.py,sha256=BNZPMjGiWLMBH7QDtP06WEVLMnI38NLX4Dpd13bSbi4,16614
@@ -57,7 +57,7 @@ ScriptCollection/TFCPS/Docker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
57
57
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationBase.py,sha256=bT6Gd5pQpZCw4OQz6HWkPCSn5z__eUUEisABLDSxd0o,200
58
58
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationGenerate.py,sha256=QyjOfMY22JWCvKjMelHiDWbJiWqotOfebpJpgDUaoO4,237
59
59
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationNoGenerate.py,sha256=i0zEGehj0sttxjjZtoq2KFSKp_ulxVyWp_ZgAhIY_So,241
60
- ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=aA2hii53AZP_-CMU1cmrId4PbQJnzryLMAKsqtkRTaE,63167
60
+ ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=hvSQVK59u9dL4mqvPrAq1Z_f0NsUIBLIfR267xdZixU,63158
61
61
  ScriptCollection/TFCPS/DotNet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
62
62
  ScriptCollection/TFCPS/Flutter/TFCPS_CodeUnitSpecific_Flutter.py,sha256=4z6Az3I_qhd-l7EGFYiBllKZUWD3HppZpwurNA_u15U,58484
63
63
  ScriptCollection/TFCPS/Flutter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -73,8 +73,8 @@ ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=yyjWPMHQjPLkML
73
73
  ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
74
74
  ScriptCollection/TFCPS/TypeScript/TFCPS_CodeUnitSpecific_TypeScript.py,sha256=ILVhJHvwG5TvPBBqSvyACYb7W9QnWrJpxKgHu8IQu4g,9249
75
75
  ScriptCollection/TFCPS/TypeScript/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
76
- scriptcollection-4.4.49.dist-info/METADATA,sha256=SoS0zLNqVIlCQGhB9oe61J3sqf9_7ll0NOByqmjrSQo,8032
77
- scriptcollection-4.4.49.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
78
- scriptcollection-4.4.49.dist-info/entry_points.txt,sha256=1nA5gUD0Y9L105JGIfTnnqDZhFjzKcFpFaUSrLn-Sw0,5991
79
- scriptcollection-4.4.49.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
80
- scriptcollection-4.4.49.dist-info/RECORD,,
76
+ scriptcollection-4.4.50.dist-info/METADATA,sha256=knE2pvG3kh25Xioq9FaXbtdFH0lS8Lrce8cf-XZIlBE,8032
77
+ scriptcollection-4.4.50.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
78
+ scriptcollection-4.4.50.dist-info/entry_points.txt,sha256=1nA5gUD0Y9L105JGIfTnnqDZhFjzKcFpFaUSrLn-Sw0,5991
79
+ scriptcollection-4.4.50.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
80
+ scriptcollection-4.4.50.dist-info/RECORD,,