ScriptCollection 3.5.98__py3-none-any.whl → 3.5.100__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.
@@ -952,6 +952,7 @@ class GeneralUtilities:
952
952
  @staticmethod
953
953
  @check_arguments
954
954
  def replace_variable_in_string(input_string: str, variable_name: str, variable_value: str) -> None:
955
+ GeneralUtilities.assert_condition(not "__" in variable_name, f"'{variable_name}' is an invalid variable name because it contains '__' which is treated as control-sequence.")
955
956
  return input_string.replace(f"__[{variable_name}]__", variable_value)
956
957
 
957
958
  @staticmethod
@@ -33,7 +33,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
33
33
  from .ProgramRunnerPopen import ProgramRunnerPopen
34
34
  from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
35
35
 
36
- version = "3.5.98"
36
+ version = "3.5.100"
37
37
  __version__ = version
38
38
 
39
39
 
@@ -875,6 +875,10 @@ class TasksForCommonProjectStructure:
875
875
  content = re.sub("filename=\"([^\"]+)\"", lambda match: self.__standardized_tasks_run_testcases_for_dotnet_project_helper(source_base_path_in_coverage_file, codeunit_folder, match), content)
876
876
  GeneralUtilities.write_text_to_file(target_file, content)
877
877
  self.run_testcases_common_post_task(repository_folder, codeunit_name, verbosity, generate_badges, targetenvironmenttype, commandline_arguments)
878
+ artifacts_folder = os.path.join(repository_folder, codeunit_name, "Other", "Artifacts")
879
+ for subfolder in GeneralUtilities.get_direct_folders_of_folder(artifacts_folder):
880
+ if os.path.basename(subfolder).startswith("BuildResultTests_DotNet_"):
881
+ GeneralUtilities.ensure_directory_does_not_exist(subfolder)
878
882
 
879
883
  @GeneralUtilities.check_arguments
880
884
  def run_testcases_common_post_task(self, repository_folder: str, codeunit_name: str, verbosity: int, generate_badges: bool, targetenvironmenttype: str, commandline_arguments: list[str]) -> None:
@@ -1486,7 +1490,7 @@ class TasksForCommonProjectStructure:
1486
1490
  @GeneralUtilities.check_arguments
1487
1491
  def standardized_tasks_do_common_tasks(self, common_tasks_scripts_file: str, codeunit_version: str, verbosity: int, targetenvironmenttype: str, clear_artifacts_folder: bool, additional_arguments_file: str, assume_dependent_codeunits_are_already_built: bool, commandline_arguments: list[str]) -> None:
1488
1492
  additional_arguments_file = self.get_additionalargumentsfile_from_commandline_arguments(commandline_arguments, additional_arguments_file)
1489
- target_environmenttype = self.get_targetenvironmenttype_from_commandline_arguments(commandline_arguments, targetenvironmenttype)#pylint: disable=unused-variable
1493
+ target_environmenttype = self.get_targetenvironmenttype_from_commandline_arguments(commandline_arguments, targetenvironmenttype) # pylint: disable=unused-variable
1490
1494
  # assume_dependent_codeunits_are_already_built = self.get_assume_dependent_codeunits_are_already_built_from_commandline_arguments(commandline_arguments, assume_dependent_codeunits_are_already_built)
1491
1495
  if commandline_arguments is None:
1492
1496
  raise ValueError('The "commandline_arguments"-parameter is not defined.')
@@ -2227,7 +2231,7 @@ class TasksForCommonProjectStructure:
2227
2231
  shutil.copytree(artifacts_folder, target_folder)
2228
2232
 
2229
2233
  @GeneralUtilities.check_arguments
2230
- def add_github_release(self, productname: str, projectversion: str, build_artifacts_folder: str, github_username: str, repository_folder: str, commandline_arguments: list[str]) -> None:
2234
+ def add_github_release(self, productname: str, projectversion: str, build_artifacts_folder: str, github_username: str, repository_folder: str, commandline_arguments: list[str], additional_attached_files: list[str]) -> None:
2231
2235
  self.__sc.assert_is_git_repository(repository_folder)
2232
2236
  GeneralUtilities.write_message_to_stdout(f"Create GitHub-release for {productname}...")
2233
2237
  verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, 1)
@@ -2236,6 +2240,9 @@ class TasksForCommonProjectStructure:
2236
2240
  codeunits = self.get_codeunits(repository_folder)
2237
2241
  for codeunit in codeunits:
2238
2242
  artifact_files.append(self.__sc.find_file_by_extension(f"{build_artifacts_folder}\\{productname}\\{projectversion}\\{codeunit}", "Productive.Artifacts.zip"))
2243
+ if additional_attached_files is not None:
2244
+ for additional_attached_file in additional_attached_files:
2245
+ artifact_files.append(additional_attached_file)
2239
2246
  changelog_file = os.path.join(repository_folder, "Other", "Resources", "Changelog", f"v{projectversion}.md")
2240
2247
  self.__sc.run_program_argsasarray("gh", ["release", "create", f"v{projectversion}", "--repo", github_repo, "--notes-file", changelog_file, "--title", f"Release v{projectversion}"]+artifact_files, verbosity=verbosity)
2241
2248
 
@@ -2517,7 +2524,7 @@ class TasksForCommonProjectStructure:
2517
2524
  project_resources_folder = os.path.join(repository_folder, "Other", "Scripts")
2518
2525
  PrepareBuildCodeunits_script_name = "PrepareBuildCodeunits.py"
2519
2526
  prepare_build_codeunits_scripts = os.path.join(project_resources_folder, PrepareBuildCodeunits_script_name)
2520
-
2527
+
2521
2528
  if do_git_clean_when_no_changes:
2522
2529
  self.__sc.run_program("git", "clean -dfx", repository_folder)
2523
2530
  if os.path.isfile(prepare_build_codeunits_scripts):
@@ -2742,9 +2749,9 @@ class TasksForCommonProjectStructure:
2742
2749
  self.ensure_file_from_github_assets_is_available_with_retry(target_folder, "CycloneDX", "cyclonedx-cli", "CycloneDXCLI", local_filename, lambda latest_version: filename_on_github)
2743
2750
 
2744
2751
  @GeneralUtilities.check_arguments
2745
- def ensure_file_from_github_assets_is_available_with_retry(self, target_folder: str, githubuser: str, githubprojectname: str, resource_name: str, local_filename: str, get_filename_on_github,amount_of_attempts:int=5) -> None:
2752
+ def ensure_file_from_github_assets_is_available_with_retry(self, target_folder: str, githubuser: str, githubprojectname: str, resource_name: str, local_filename: str, get_filename_on_github, amount_of_attempts: int = 5) -> None:
2746
2753
  GeneralUtilities.retry_action(lambda: self.ensure_file_from_github_assets_is_available(target_folder, githubuser, githubprojectname, resource_name, local_filename, get_filename_on_github), amount_of_attempts)
2747
-
2754
+
2748
2755
  @GeneralUtilities.check_arguments
2749
2756
  def ensure_file_from_github_assets_is_available(self, target_folder: str, githubuser: str, githubprojectname: str, resource_name: str, local_filename: str, get_filename_on_github) -> None:
2750
2757
  resource_folder = os.path.join(target_folder, "Other", "Resources", resource_name)
@@ -2871,6 +2878,36 @@ class TasksForCommonProjectStructure:
2871
2878
  control_file_content = self.load_deb_control_file_content(control_file, codeunit_name, self.get_version_of_codeunit_folder(codeunit_folder), installedsize, maintainername, maintaineremail, description)
2872
2879
  self.__sc.create_deb_package(codeunit_name, binary_folder, control_file_content, deb_output_folder, verbosity, 555)
2873
2880
 
2881
+ @GeneralUtilities.check_arguments
2882
+ def create_zip_file_for_artifact(self, codeunit_folder: str, artifact_source_name: str, name_of_new_artifact: str, verbosity: int, cmd_arguments: list[str]) -> None:
2883
+ self.assert_is_codeunit_folder(codeunit_folder)
2884
+ verbosity = self.get_verbosity_from_commandline_arguments(cmd_arguments, verbosity)
2885
+ src_artifact_folder = GeneralUtilities.resolve_relative_path(f"Other/Artifacts/{artifact_source_name}", codeunit_folder)
2886
+ shutil.make_archive(name_of_new_artifact, 'zip', src_artifact_folder)
2887
+ archive_file = os.path.join(os.getcwd(), f"{name_of_new_artifact}.zip")
2888
+ target_folder = GeneralUtilities.resolve_relative_path(f"Other/Artifacts/{name_of_new_artifact}", codeunit_folder)
2889
+ GeneralUtilities.ensure_folder_exists_and_is_empty(target_folder)
2890
+ shutil.move(archive_file, target_folder)
2891
+
2892
+ def generate_winget_zip_manifest(self, codeunit_folder: str, artifact_name_of_zip: str):
2893
+ self.assert_is_codeunit_folder(codeunit_folder)
2894
+ codeunit_version = self.get_version_of_codeunit_folder(codeunit_folder)
2895
+ build_folder = os.path.join(codeunit_folder, "Other", "Build")
2896
+ artifacts_folder = os.path.join(codeunit_folder, "Other", "Artifacts", artifact_name_of_zip)
2897
+ GeneralUtilities.assert_folder_exists(artifacts_folder)
2898
+ artifacts_file = ScriptCollectionCore().find_file_by_extension(artifacts_folder, "zip")
2899
+ winget_template_file = os.path.join(build_folder, "WinGet-Template.yaml")
2900
+ winget_manifest_file = os.path.join(build_folder, "WinGet-Manifest.yaml")
2901
+ GeneralUtilities.assert_file_exists(winget_template_file)
2902
+ GeneralUtilities.ensure_file_exists(winget_manifest_file)
2903
+ manifest_content = GeneralUtilities.read_text_from_file(winget_template_file)
2904
+ manifest_content = GeneralUtilities.replace_variable_in_string(manifest_content, "version", codeunit_version)
2905
+ manifest_content = GeneralUtilities.replace_variable_in_string(manifest_content, "sha256_hashvalue", GeneralUtilities.get_sha256_of_file(artifacts_file))
2906
+ GeneralUtilities.write_text_to_file(winget_manifest_file, manifest_content)
2907
+ target_folder = os.path.join(codeunit_folder, "Other", "Artifacts", "WinGet-Manifest")
2908
+ GeneralUtilities.ensure_folder_exists_and_is_empty(target_folder)
2909
+ shutil.copy(winget_manifest_file, target_folder)
2910
+
2874
2911
  @GeneralUtilities.check_arguments
2875
2912
  def update_year_in_license_file_in_common_scripts_file(self, common_tasks_scripts_file: str) -> None:
2876
2913
  self.update_year_in_license_file(GeneralUtilities.resolve_relative_path("../../..", common_tasks_scripts_file))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ScriptCollection
3
- Version: 3.5.98
3
+ Version: 3.5.100
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
@@ -23,7 +23,7 @@ Classifier: Topic :: Utilities
23
23
  Requires-Python: >=3.10
24
24
  Description-Content-Type: text/markdown
25
25
  Requires-Dist: build>=1.2.2.post1
26
- Requires-Dist: coverage>=7.6.12
26
+ Requires-Dist: coverage>=7.7.0
27
27
  Requires-Dist: cyclonedx-bom>=5.3.0
28
28
  Requires-Dist: defusedxml>=0.7.1
29
29
  Requires-Dist: keyboard>=0.13.5
@@ -1,17 +1,17 @@
1
1
  ScriptCollection/Executables.py,sha256=HI9Pxs5Z9QxPGyqeJU2lWslEggFyGYANCqYVQZp6eJ0,30490
2
- ScriptCollection/GeneralUtilities.py,sha256=q0ikIwmhklCFsaaj9YGPGdrNonibuRmWofvbwOtlxdM,42246
2
+ ScriptCollection/GeneralUtilities.py,sha256=unOZbHDqlxwPHXY1epy4gdGYwDbHEETF1XKZYPGX2hw,42429
3
3
  ScriptCollection/ProcessesRunner.py,sha256=3mu4ZxzZleQo0Op6o9EYTCFiJfb6kx5ov2YfZfT89mU,1395
4
4
  ScriptCollection/ProgramRunnerBase.py,sha256=2kMIAqdc65UjBAddOZkzy_aFx9h5roZ5a4bQNM6RV6Y,2480
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
8
  ScriptCollection/SCLog.py,sha256=l4aekBiGoNkKGtvO_Er3NY_K7ts4ZWtIGlhq07I-4LY,30
9
- ScriptCollection/ScriptCollectionCore.py,sha256=BeUb9YO7qeFfkM66-iRFWBh_YV8lYUFY7IHDAxu8G7M,123983
10
- ScriptCollection/TasksForCommonProjectStructure.py,sha256=FX8Jnuy9V8MHeOUW_Ifbw6b2nQGbV9Xm5YPeDIJyUgU,227251
9
+ ScriptCollection/ScriptCollectionCore.py,sha256=UxY2NmrtgK-GJmuSpANtgUoxjbwVqti1rrR55Rz13DU,123984
10
+ ScriptCollection/TasksForCommonProjectStructure.py,sha256=CkLRb4-ldwVuc6XlORxxyhN3GDR8TZSfe3DUqRl0SKg,230241
11
11
  ScriptCollection/UpdateCertificates.py,sha256=Eynbgu7k9jLxApP2D_8Il77B6BFjJap6K7oTeEAZYbk,7790
12
12
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- scriptcollection-3.5.98.dist-info/METADATA,sha256=NelJnZ3uMi-Y0tuEwmCq0bt0ujwPkJxI3aY6BXTwohw,7664
14
- scriptcollection-3.5.98.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
15
- scriptcollection-3.5.98.dist-info/entry_points.txt,sha256=fYCGWGNGijBQHhFe6UAO-BEpfEOxLyNJemukt5ElSzs,3644
16
- scriptcollection-3.5.98.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
17
- scriptcollection-3.5.98.dist-info/RECORD,,
13
+ scriptcollection-3.5.100.dist-info/METADATA,sha256=MxfzekKeh4Ed-NOAXbl1CEEB_nVgb5ibJ_ZwZxvFnlg,7664
14
+ scriptcollection-3.5.100.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
15
+ scriptcollection-3.5.100.dist-info/entry_points.txt,sha256=fYCGWGNGijBQHhFe6UAO-BEpfEOxLyNJemukt5ElSzs,3644
16
+ scriptcollection-3.5.100.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
17
+ scriptcollection-3.5.100.dist-info/RECORD,,