ScriptCollection 3.5.64__py3-none-any.whl → 3.5.65__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.
@@ -31,7 +31,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
31
31
  from .ProgramRunnerPopen import ProgramRunnerPopen
32
32
  from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
33
33
 
34
- version = "3.5.64"
34
+ version = "3.5.65"
35
35
  __version__ = version
36
36
 
37
37
 
@@ -267,6 +267,10 @@ class ScriptCollectionCore:
267
267
  result = datetime.strptime(date_as_string, '%Y-%m-%d %H:%M:%S %z')
268
268
  return result
269
269
 
270
+ @GeneralUtilities.check_arguments
271
+ def git_fetch_with_retry(self, folder: str, remotename: str = "--all", amount_of_attempts: int = 5) -> None:
272
+ GeneralUtilities.retry_action(lambda: self.git_fetch(folder, remotename), amount_of_attempts)
273
+
270
274
  @GeneralUtilities.check_arguments
271
275
  def git_fetch(self, folder: str, remotename: str = "--all") -> None:
272
276
  self.run_program_argsasarray("git", ["fetch", remotename, "--tags", "--prune"], folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
@@ -280,8 +284,8 @@ class ScriptCollectionCore:
280
284
  self.run_program("git", f"branch -D {branchname}", folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
281
285
 
282
286
  @GeneralUtilities.check_arguments
283
- 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_amounts: int = 5) -> None:
284
- GeneralUtilities.retry_action(lambda: self.git_push(folder, remotename, localbranchname, remotebranchname, forcepush, pushalltags), amount_of_amounts)
287
+ 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:
288
+ GeneralUtilities.retry_action(lambda: self.git_push(folder, remotename, localbranchname, remotebranchname, forcepush, pushalltags), amount_of_attempts)
285
289
 
286
290
  @GeneralUtilities.check_arguments
287
291
  def git_push(self, folder: str, remotename: str, localbranchname: str, remotebranchname: str, forcepush: bool = False, pushalltags: bool = True, verbosity: int = 0) -> None:
@@ -293,6 +297,10 @@ class ScriptCollectionCore:
293
297
  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)
294
298
  return result[1].replace('\r', '').replace('\n', '')
295
299
 
300
+ @GeneralUtilities.check_arguments
301
+ def git_pull_with_retry(self, folder: str, remote: str, localbranchname: str, remotebranchname: str, force: bool = False, amount_of_attempts: int = 5) -> None:
302
+ GeneralUtilities.retry_action(lambda: self.git_pull_with_retry(folder, remote,localbranchname,remotebranchname), amount_of_attempts)
303
+
296
304
  @GeneralUtilities.check_arguments
297
305
  def git_pull(self, folder: str, remote: str, localbranchname: str, remotebranchname: str, force: bool = False) -> None:
298
306
  argument = f"pull {remote} {remotebranchname}:{localbranchname}"
@@ -1340,8 +1348,10 @@ class ScriptCollectionCore:
1340
1348
  if arguments_for_log is None:
1341
1349
  arguments_for_log = arguments_as_array
1342
1350
 
1343
- arguments_for_log_as_string: str = ' '.join(arguments_for_log)
1344
- cmd = f'{working_directory}>{program} {arguments_for_log_as_string}'
1351
+ cmd = f'{working_directory}>{program}'
1352
+ if 0 < len(arguments_for_log):
1353
+ arguments_for_log_as_string: str = ' '.join([f'"{argument_for_log}"' for argument_for_log in arguments_for_log])
1354
+ cmd = f'{cmd} {arguments_for_log_as_string}'
1345
1355
 
1346
1356
  if GeneralUtilities.string_is_none_or_whitespace(title):
1347
1357
  info_for_log = cmd
@@ -2442,8 +2442,8 @@ class TasksForCommonProjectStructure:
2442
2442
  self.__sc.assert_is_git_repository(repository_folder)
2443
2443
  self.__check_target_environmenttype(target_environmenttype)
2444
2444
  repository_folder = GeneralUtilities.resolve_relative_path_from_current_working_directory(repository_folder)
2445
- contains_uncommitted_changes = self.__sc.git_repository_has_uncommitted_changes(repository_folder)
2446
- if contains_uncommitted_changes:
2445
+ contains_uncommitted_changes_at_begin = self.__sc.git_repository_has_uncommitted_changes(repository_folder)
2446
+ if contains_uncommitted_changes_at_begin:
2447
2447
  if is_pre_merge:
2448
2448
  raise ValueError(f'Repository "{repository_folder}" has uncommitted changes.')
2449
2449
  else:
@@ -2457,7 +2457,7 @@ class TasksForCommonProjectStructure:
2457
2457
  prepare_build_codeunits_scripts = os.path.join(project_resources_folder, PrepareBuildCodeunits_script_name)
2458
2458
  if os.path.isfile(prepare_build_codeunits_scripts):
2459
2459
  GeneralUtilities.write_message_to_stdout(f'Run "{PrepareBuildCodeunits_script_name}"')
2460
- self.__sc.run_program("python", f"{PrepareBuildCodeunits_script_name}", project_resources_folder,print_live_output=1<verbosity)
2460
+ self.__sc.run_program("python", f"{PrepareBuildCodeunits_script_name}", project_resources_folder, print_live_output=1 < verbosity)
2461
2461
 
2462
2462
  for subfolder in subfolders:
2463
2463
  codeunit_name: str = os.path.basename(subfolder)
@@ -2491,12 +2491,16 @@ class TasksForCommonProjectStructure:
2491
2491
  GeneralUtilities.write_message_to_stdout(line)
2492
2492
  self.__build_codeunit(os.path.join(repository_folder, codeunit), verbosity, target_environmenttype, additional_arguments_file, is_pre_merge, assume_dependent_codeunits_are_already_built, commandline_arguments)
2493
2493
  GeneralUtilities.write_message_to_stdout(line)
2494
- if not contains_uncommitted_changes and self.__sc.git_repository_has_uncommitted_changes(repository_folder) and not is_pre_merge:
2495
- message = f'Due to the build-process the repository "{repository_folder}" has new uncommitted changes.'
2496
- if target_environmenttype == "Development":
2497
- GeneralUtilities.write_message_to_stdout(message)
2494
+ contains_uncommitted_changes_at_end = self.__sc.git_repository_has_uncommitted_changes(repository_folder)
2495
+ if contains_uncommitted_changes_at_end and not is_pre_merge:
2496
+ if contains_uncommitted_changes_at_begin:
2497
+ GeneralUtilities.write_message_to_stdout(f'There are still uncommitted changes in the repository "{repository_folder}".')
2498
2498
  else:
2499
- raise ValueError(message)
2499
+ message = f'Due to the build-process the repository "{repository_folder}" has new uncommitted changes.'
2500
+ if target_environmenttype == "Development":
2501
+ GeneralUtilities.write_message_to_stderr(f"Warning: {message}")
2502
+ else:
2503
+ raise ValueError(message)
2500
2504
  if export_target_directory is not None:
2501
2505
  project_name = self.get_project_name(repository_folder)
2502
2506
  for codeunit in sorted_codeunits:
@@ -2809,11 +2813,11 @@ class TasksForCommonProjectStructure:
2809
2813
  c_additionalargumentsfile_argument = f' --overwrite_additionalargumentsfile "{additional_arguments_file}"'
2810
2814
 
2811
2815
  GeneralUtilities.write_message_to_stdout('Run "CommonTasks.py"...')
2812
- self.__sc.run_program("python", f"CommonTasks.py{additional_arguments_c}{general_argument}{c_additionalargumentsfile_argument}", other_folder, verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True,print_live_output=1<verbosity)
2816
+ self.__sc.run_program("python", f"CommonTasks.py{additional_arguments_c}{general_argument}{c_additionalargumentsfile_argument}", other_folder, verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True, print_live_output=2 < verbosity)
2813
2817
  self.verify_artifact_exists(codeunit_folder, dict[str, bool]({"Changelog": False, "License": True, "DiffReport": True}))
2814
2818
 
2815
2819
  GeneralUtilities.write_message_to_stdout('Run "Build.py"...')
2816
- self.__sc.run_program("python", f"Build.py{additional_arguments_b}{general_argument}", build_folder, verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True,print_live_output=1<verbosity)
2820
+ self.__sc.run_program("python", f"Build.py{additional_arguments_b}{general_argument}", build_folder, verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True, print_live_output=2 < verbosity)
2817
2821
 
2818
2822
  artifacts = {"BuildResult_.+": True, "BOM": False, "SourceCode": True}
2819
2823
  if self.codeunit_has_testable_sourcecode(codeunit_file):
@@ -2823,20 +2827,20 @@ class TasksForCommonProjectStructure:
2823
2827
  codeunit_hast_testable_sourcecode = self.codeunit_has_testable_sourcecode(codeunit_file)
2824
2828
  if codeunit_hast_testable_sourcecode:
2825
2829
  GeneralUtilities.write_message_to_stdout('Run "RunTestcases.py"...')
2826
- self.__sc.run_program("python", f"RunTestcases.py{additional_arguments_r}{general_argument}", quality_folder, verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True,print_live_output=1<verbosity)
2830
+ self.__sc.run_program("python", f"RunTestcases.py{additional_arguments_r}{general_argument}", quality_folder, verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True, print_live_output=2 < verbosity)
2827
2831
  self.verify_artifact_exists(codeunit_folder, dict[str, bool]({"TestCoverage": True, "TestCoverageReport": False}))
2828
2832
 
2829
2833
  GeneralUtilities.write_message_to_stdout('Run "Linting.py"...')
2830
- self.__sc.run_program("python", f"Linting.py{additional_arguments_l}{general_argument}", quality_folder, verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True,print_live_output=1<verbosity)
2834
+ self.__sc.run_program("python", f"Linting.py{additional_arguments_l}{general_argument}", quality_folder, verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True, print_live_output=2 < verbosity)
2831
2835
  self.verify_artifact_exists(codeunit_folder, dict[str, bool]())
2832
2836
 
2833
2837
  GeneralUtilities.write_message_to_stdout('Run "GenerateReference.py"...')
2834
- self.__sc.run_program("python", f"GenerateReference.py{additional_arguments_g}{general_argument}", reference_folder, verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True,print_live_output=1<verbosity)
2838
+ self.__sc.run_program("python", f"GenerateReference.py{additional_arguments_g}{general_argument}", reference_folder, verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True, print_live_output=2 < verbosity)
2835
2839
  self.verify_artifact_exists(codeunit_folder, dict[str, bool]({"Reference": True}))
2836
2840
 
2837
2841
  if os.path.isfile(os.path.join(other_folder, "OnBuildingFinished.py")):
2838
2842
  GeneralUtilities.write_message_to_stdout('Run "OnBuildingFinished.py"...')
2839
- self.__sc.run_program("python", f"OnBuildingFinished.py{additional_arguments_f}{general_argument}", other_folder, verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True,print_live_output=1<verbosity)
2843
+ self.__sc.run_program("python", f"OnBuildingFinished.py{additional_arguments_f}{general_argument}", other_folder, verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True, print_live_output=2 < verbosity)
2840
2844
 
2841
2845
  artifactsinformation_file = os.path.join(artifacts_folder, f"{codeunit_name}.artifactsinformation.xml")
2842
2846
  codeunit_version = self.get_version_of_codeunit(codeunit_file)
@@ -2869,7 +2873,7 @@ class TasksForCommonProjectStructure:
2869
2873
  codeunits = self.get_codeunits(repository_folder)
2870
2874
  updated_dependencies = False
2871
2875
  update_dependencies_script_filename = "UpdateDependencies.py"
2872
- self.__sc.run_program("scbuildcodeunits", "", repository_folder) # Required because update dependencies is not always possible for not-buildet codeunits (depends on the programming language or package manager)
2876
+ self.build_codeunits(repository_folder, target_environmenttype="QualityCheck", do_git_clean_when_no_changes=True) # Required because update dependencies is not always possible for not-buildet codeunits (depends on the programming language or package manager)
2873
2877
 
2874
2878
  # update dependencies of resources
2875
2879
  global_scripts_folder = os.path.join(repository_folder, "Other", "Scripts")
@@ -2900,7 +2904,7 @@ class TasksForCommonProjectStructure:
2900
2904
  else:
2901
2905
  GeneralUtilities.write_message_to_stdout(f"There are no dependencies to update in codeunit {codeunit}.")
2902
2906
  if updated_dependencies:
2903
- self.__sc.run_program("scbuildcodeunits", "--targetenvironment QualityCheck --removeuncommittedfiles", repository_folder, verbosity=verbosity) # TODO set timeout
2907
+ self.build_codeunits(repository_folder, target_environmenttype="QualityCheck", do_git_clean_when_no_changes=True)
2904
2908
  self.__sc.git_commit(repository_folder, "Updated dependencies")
2905
2909
 
2906
2910
  class GenericPrepareNewReleaseArguments:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ScriptCollection
3
- Version: 3.5.64
3
+ Version: 3.5.65
4
4
  Summary: The ScriptCollection is the place for reusable scripts.
5
5
  Home-page: https://github.com/anionDev/ScriptCollection
6
6
  Author: Marius Göcke
@@ -5,12 +5,12 @@ ScriptCollection/ProgramRunnerBase.py,sha256=2kMIAqdc65UjBAddOZkzy_aFx9h5roZ5a4b
5
5
  ScriptCollection/ProgramRunnerEpew.py,sha256=4pjEd0r9Fcz3TTDv0MdTSd5KkigYXcWUVI1X43regfU,6477
6
6
  ScriptCollection/ProgramRunnerPopen.py,sha256=BPY7-ZMIlqT7JOKz8qlB5c0laF2Js-ijzqk09GxZC48,3821
7
7
  ScriptCollection/RPStream.py,sha256=NRRHL3YSP3D9MuAV2jB_--0KUKCsvJGxeKnxgrRZ9kY,1545
8
- ScriptCollection/ScriptCollectionCore.py,sha256=9ya2ztbPuuQxQEk4FOqhA7XL-Cwh7osTjEN0GPKHpDM,111127
9
- ScriptCollection/TasksForCommonProjectStructure.py,sha256=byU3N2MdcVCScm2DGuRLFuIomjFL8cjOI7k1sBVVCX8,213300
8
+ ScriptCollection/ScriptCollectionCore.py,sha256=NrBHbyNrj604n0TxVMeDiFUjy4lprLU4OUskTJOKgJo,111855
9
+ ScriptCollection/TasksForCommonProjectStructure.py,sha256=xwEhBfIbrRCMxbklBsQnxnuJ07UQgqYy_fjcv-QXJeQ,213628
10
10
  ScriptCollection/UpdateCertificates.py,sha256=Eynbgu7k9jLxApP2D_8Il77B6BFjJap6K7oTeEAZYbk,7790
11
11
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- ScriptCollection-3.5.64.dist-info/METADATA,sha256=8d92Y7ZmlIECWchsTA4hSaU5dqjlw8ffQSE6Pl5QHIo,7664
13
- ScriptCollection-3.5.64.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
14
- ScriptCollection-3.5.64.dist-info/entry_points.txt,sha256=wspYVXWH8kon-wRQTAFEO11JoLJ0fEnOIG7tE7R-xtQ,3502
15
- ScriptCollection-3.5.64.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
- ScriptCollection-3.5.64.dist-info/RECORD,,
12
+ ScriptCollection-3.5.65.dist-info/METADATA,sha256=Jqom1sT8VzQZYDWskp7RYVonlTfNhzVcdu3dLahv4Cs,7664
13
+ ScriptCollection-3.5.65.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
14
+ ScriptCollection-3.5.65.dist-info/entry_points.txt,sha256=wspYVXWH8kon-wRQTAFEO11JoLJ0fEnOIG7tE7R-xtQ,3502
15
+ ScriptCollection-3.5.65.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
+ ScriptCollection-3.5.65.dist-info/RECORD,,