ScriptCollection 3.5.49__py3-none-any.whl → 3.5.52__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.
@@ -838,8 +838,11 @@ class GeneralUtilities:
838
838
 
839
839
  @staticmethod
840
840
  @check_arguments
841
- def assert_condition(condition: bool, information: str) -> None:
841
+ def assert_condition(condition: bool, information: str = None) -> None:
842
+ """Throws an exception if the condition is false."""
842
843
  if (not condition):
844
+ if information is None:
845
+ information = "Internal assertion error."
843
846
  raise ValueError("Condition failed. "+information)
844
847
 
845
848
  @staticmethod
@@ -911,3 +914,18 @@ class GeneralUtilities:
911
914
  @check_arguments
912
915
  def assert_folder_exists(folder: str) -> str:
913
916
  GeneralUtilities.assert_condition(os.path.isdir(folder), f"Folder '{folder}' does not exist.")
917
+
918
+ @staticmethod
919
+ @check_arguments
920
+ def retry_action(action, amount_of_attempts: int) -> None:
921
+ amount_of_fails = 0
922
+ enabled = True
923
+ while enabled:
924
+ try:
925
+ action()
926
+ return
927
+ except Exception:
928
+ amount_of_fails = amount_of_fails+1
929
+ GeneralUtilities.assert_condition(not (amount_of_attempts < amount_of_fails))
930
+ if amount_of_fails == amount_of_attempts:
931
+ raise
@@ -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.49"
34
+ version = "3.5.52"
35
35
  __version__ = version
36
36
 
37
37
 
@@ -279,6 +279,10 @@ class ScriptCollectionCore:
279
279
  def git_remove_branch(self, folder: str, branchname: str) -> None:
280
280
  self.run_program("git", f"branch -D {branchname}", folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
281
281
 
282
+ @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)
285
+
282
286
  @GeneralUtilities.check_arguments
283
287
  def git_push(self, folder: str, remotename: str, localbranchname: str, remotebranchname: str, forcepush: bool = False, pushalltags: bool = True, verbosity: int = 0) -> None:
284
288
  argument = ["push", "--recurse-submodules=on-demand", remotename, f"{localbranchname}:{remotebranchname}"]
@@ -1291,7 +1291,7 @@ class TasksForCommonProjectStructure:
1291
1291
 
1292
1292
  self.__sc.git_commit(createReleaseInformation.reference_repository, f"Added reference of {createRelease_configuration.projectname} v{new_project_version}")
1293
1293
  if createRelease_configuration.reference_repository_remote_name is not None:
1294
- self.__sc.git_push(createReleaseInformation.reference_repository, createRelease_configuration.reference_repository_remote_name, createRelease_configuration.reference_repository_branch_name, createRelease_configuration.reference_repository_branch_name, verbosity=createRelease_configuration.verbosity)
1294
+ self.__sc.git_push_with_retry(createReleaseInformation.reference_repository, createRelease_configuration.reference_repository_remote_name, createRelease_configuration.reference_repository_branch_name, createRelease_configuration.reference_repository_branch_name, verbosity=createRelease_configuration.verbosity)
1295
1295
  self.__sc.git_commit(build_repository_folder, f"Added {createRelease_configuration.projectname} release v{new_project_version}")
1296
1296
  GeneralUtilities.write_message_to_stdout(f"Finished release for project {createRelease_configuration.projectname} v{new_project_version} successfully.")
1297
1297
  return new_project_version
@@ -1323,11 +1323,11 @@ class TasksForCommonProjectStructure:
1323
1323
 
1324
1324
  if information.push_source_branch:
1325
1325
  GeneralUtilities.write_message_to_stdout("Push source-branch...")
1326
- self.__sc.git_push(information.repository, information.push_source_branch_remote_name, information.sourcebranch, information.sourcebranch, pushalltags=True, verbosity=information.verbosity)
1326
+ self.__sc.git_push_with_retry(information.repository, information.push_source_branch_remote_name, information.sourcebranch, information.sourcebranch, pushalltags=True, verbosity=information.verbosity)
1327
1327
 
1328
1328
  if information.push_target_branch:
1329
1329
  GeneralUtilities.write_message_to_stdout("Push target-branch...")
1330
- self.__sc.git_push(information.repository, information.push_target_branch_remote_name, information.targetbranch, information.targetbranch, pushalltags=True, verbosity=information.verbosity)
1330
+ self.__sc.git_push_with_retry(information.repository, information.push_target_branch_remote_name, information.targetbranch, information.targetbranch, pushalltags=True, verbosity=information.verbosity)
1331
1331
 
1332
1332
  return project_version
1333
1333
 
@@ -2471,7 +2471,7 @@ class TasksForCommonProjectStructure:
2471
2471
  if not self.__suport_information_exists(repository_folder, project_version):
2472
2472
  support_time = timedelta(days=365*2+30*3+1) # TODO make this configurable
2473
2473
  until = now + support_time
2474
- until_day=datetime(until.year,until.month,until.day,0,0,0)
2474
+ until_day = datetime(until.year, until.month, until.day, 0, 0, 0)
2475
2475
  self.mark_current_version_as_supported(repository_folder, project_version, now, until_day)
2476
2476
 
2477
2477
  if len(sorted_codeunits) == 0:
@@ -3052,5 +3052,5 @@ class TasksForCommonProjectStructure:
3052
3052
  self.__sc.git_fetch(ref_repo, update_http_documentation_arguments.common_remote_name)
3053
3053
  self.__sc.git_merge(ref_repo, update_http_documentation_arguments.common_remote_name+"/"+update_http_documentation_arguments.main_branch_name, update_http_documentation_arguments.main_branch_name)
3054
3054
  self.__sc.git_checkout(ref_repo, update_http_documentation_arguments.main_branch_name)
3055
- self.__sc.git_push(ref_repo, update_http_documentation_arguments.common_remote_name, update_http_documentation_arguments.main_branch_name, update_http_documentation_arguments.main_branch_name)
3055
+ self.__sc.git_push_with_retry(ref_repo, update_http_documentation_arguments.common_remote_name, update_http_documentation_arguments.main_branch_name, update_http_documentation_arguments.main_branch_name)
3056
3056
  self.__sc.git_commit(GeneralUtilities.resolve_relative_path("../..", folder_of_this_file), f"Updated content of {update_http_documentation_arguments.product_name} v{update_http_documentation_arguments.new_project_version} in {update_http_documentation_arguments.reference_repository_name}-submodule")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ScriptCollection
3
- Version: 3.5.49
3
+ Version: 3.5.52
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
@@ -24,7 +24,7 @@ Requires-Python: >=3.10
24
24
  Description-Content-Type: text/markdown
25
25
  Requires-Dist: build>=1.2.2.post1
26
26
  Requires-Dist: coverage>=7.6.10
27
- Requires-Dist: cyclonedx-bom>=5.1.1
27
+ Requires-Dist: cyclonedx-bom>=5.1.2
28
28
  Requires-Dist: defusedxml>=0.7.1
29
29
  Requires-Dist: keyboard>=0.13.5
30
30
  Requires-Dist: lcov-cobertura>=2.0.2
@@ -40,7 +40,7 @@ Requires-Dist: pytest>=8.3.4
40
40
  Requires-Dist: PyYAML>=6.0.2
41
41
  Requires-Dist: qrcode>=8.0
42
42
  Requires-Dist: send2trash>=1.8.3
43
- Requires-Dist: twine>=6.0.1
43
+ Requires-Dist: twine>=6.1.0
44
44
  Requires-Dist: xmlschema>=3.4.3
45
45
 
46
46
  # ScriptCollection
@@ -1,16 +1,16 @@
1
1
  ScriptCollection/Executables.py,sha256=ls3wGZpt48YwwtO0QGWWyIImSE87SyzbL-WxhpwQJug,20837
2
- ScriptCollection/GeneralUtilities.py,sha256=Kh_oSUtCyBra5LuH5_5_HkyM14YvA21ug8cK4ODsamI,37744
2
+ ScriptCollection/GeneralUtilities.py,sha256=PTe5Uz3leVoAO8Ncz5HZr_GhwZYA9XxBxIVfqPspc2s,38426
3
3
  ScriptCollection/ProcessesRunner.py,sha256=3mu4ZxzZleQo0Op6o9EYTCFiJfb6kx5ov2YfZfT89mU,1395
4
4
  ScriptCollection/ProgramRunnerBase.py,sha256=7QAjoqOz6XPmJH19F2k-Z1fFQB_uZnPFvn-T54IJcHQ,2324
5
5
  ScriptCollection/ProgramRunnerEpew.py,sha256=C2Rs3YWOWWWJct7XmKphp5CF1tf0j4Fp-ljV2drLTfs,6349
6
6
  ScriptCollection/ProgramRunnerPopen.py,sha256=UGWUK0345DmtnD1gsKa1B3tBLDzKKXUGnSbIuCSWzLU,3714
7
7
  ScriptCollection/RPStream.py,sha256=NRRHL3YSP3D9MuAV2jB_--0KUKCsvJGxeKnxgrRZ9kY,1545
8
- ScriptCollection/ScriptCollectionCore.py,sha256=CgWu2xqIYMu06BJLsBtCZ3v_GNgqzUU84xCtNKyC3O4,106702
9
- ScriptCollection/TasksForCommonProjectStructure.py,sha256=w19PqN9ICOF7vF9Muxbs-t5wPPh1qqJUvxsY5QAfpB8,213960
8
+ ScriptCollection/ScriptCollectionCore.py,sha256=CObBUiwJtZFI4wdWxSnVGrN8JPicrHw6tJ_wTwuV0LE,107117
9
+ ScriptCollection/TasksForCommonProjectStructure.py,sha256=LZszSMaMQ9xQe6HeTg_-AHYKSihBYkBeGNZyb4hUEqM,214011
10
10
  ScriptCollection/UpdateCertificates.py,sha256=Eynbgu7k9jLxApP2D_8Il77B6BFjJap6K7oTeEAZYbk,7790
11
11
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- ScriptCollection-3.5.49.dist-info/METADATA,sha256=aqDa6blUTgJpB6VFlVPGx0SjJwBJWye0lt9ihAl2R_s,7665
13
- ScriptCollection-3.5.49.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
14
- ScriptCollection-3.5.49.dist-info/entry_points.txt,sha256=_O7BmQ81LdDfrj5uOhjshg9Xc-tABHQJIxDOyOGRzzI,2397
15
- ScriptCollection-3.5.49.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
- ScriptCollection-3.5.49.dist-info/RECORD,,
12
+ ScriptCollection-3.5.52.dist-info/METADATA,sha256=KN9serefOoSGdTQPkRuXkyjVMgd-9AF_LubU4oUctKQ,7665
13
+ ScriptCollection-3.5.52.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
14
+ ScriptCollection-3.5.52.dist-info/entry_points.txt,sha256=_O7BmQ81LdDfrj5uOhjshg9Xc-tABHQJIxDOyOGRzzI,2397
15
+ ScriptCollection-3.5.52.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
+ ScriptCollection-3.5.52.dist-info/RECORD,,