ScriptCollection 4.2.63__py3-none-any.whl → 4.2.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.
@@ -1,4 +1,5 @@
1
1
  from datetime import timedelta, datetime
2
+ from functools import cmp_to_key
2
3
  import json
3
4
  import binascii
4
5
  import filecmp
@@ -36,7 +37,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
36
37
  from .ProgramRunnerPopen import ProgramRunnerPopen
37
38
  from .SCLog import SCLog, LogLevel
38
39
 
39
- version = "4.2.63"
40
+ version = "4.2.65"
40
41
  __version__ = version
41
42
 
42
43
  class VSCodeWorkspaceShellTask:
@@ -1657,14 +1658,33 @@ class ScriptCollectionCore:
1657
1658
  self.run_program("docker", f"container rm -f {container_name}")
1658
1659
 
1659
1660
  @GeneralUtilities.check_arguments
1660
- def get_latest_apt_package_version_in_debian(self, image: str,package) -> str:
1661
- #docker run --rm -it debian:13.4-slim bash -c "apt update && apt list -a tor"
1661
+ def get_latest_apt_package_version_in_debian(self, image: str,package:str) -> str:
1662
+ #docker run --rm -it debian bash -c "apt update && apt list -a tor"
1662
1663
  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)
1663
1664
  stdout=output[1]
1664
- version_line=[line.strip() for line in GeneralUtilities.string_to_lines(stdout) if GeneralUtilities.string_has_nonwhitespace_content(line) and line.startswith(package+"/")]
1665
- GeneralUtilities.assert_condition(len(version_line) ==1, f"No version found for package '{package}' in image '{image}'.")
1666
- result = version_line[0].split(" ")[1]
1667
- return result
1665
+ version_lines=[line.strip() for line in GeneralUtilities.string_to_lines(stdout) if GeneralUtilities.string_has_nonwhitespace_content(line) and line.startswith(package+"/")]
1666
+ GeneralUtilities.assert_condition(0<len(version_lines), f"No version found for package '{package}' in image '{image}'.")
1667
+ versions = [version_line.split(" ")[1] for version_line in version_lines]
1668
+ def my_comparer(a, b) -> int:
1669
+ # return:
1670
+ # -1 → a < b
1671
+ # 0 → a = b
1672
+ # 1 → a > b
1673
+ # dpkg --compare-versions <a> lt <b> → exit 0 wenn a < b
1674
+ def dpkg_compare(op: str) -> bool:
1675
+ result = self.run_program_argsasarray("docker", [ "run", "--rm",image, "dpkg", "--compare-versions", a, op, b],throw_exception_if_exitcode_is_not_zero=False)
1676
+ GeneralUtilities.assert_condition(result[1]==GeneralUtilities.empty_string)
1677
+ GeneralUtilities.assert_condition(result[2]==GeneralUtilities.empty_string)
1678
+ return result[0] == 0
1679
+
1680
+ if dpkg_compare("lt"): # a < b
1681
+ return -1
1682
+ elif dpkg_compare("gt"): # a > b
1683
+ return 1
1684
+ else:
1685
+ return 0
1686
+ sorted_versions = sorted(versions, key=cmp_to_key(my_comparer))
1687
+ return sorted_versions[-1]
1668
1688
 
1669
1689
  @GeneralUtilities.check_arguments
1670
1690
  def run_testcases_for_python_project(self, repository_folder: str):
@@ -2881,7 +2901,7 @@ OCR-content:
2881
2901
  if remove_images:
2882
2902
  self.run_program_with_retry("docker","image prune -a -f",amount_of_attempts=amount_of_attempts)
2883
2903
  self.run_program_with_retry("docker","builder prune -a -f",amount_of_attempts=amount_of_attempts)
2884
- self.run_program_with_retry("docker","buildx prune -f",amount_of_attempts=amount_of_attempts,throw_exception_if_exitcode_is_not_zero=False) # buildx prune is not available on every machine.
2904
+ self.run_program_with_retry("docker","buildx prune -a -f",amount_of_attempts=amount_of_attempts,throw_exception_if_exitcode_is_not_zero=False) # buildx prune is not available on every machine.
2885
2905
  self.run_program_with_retry("docker","system df",print_live_output=self.log.loglevel==LogLevel.Debug,amount_of_attempts=amount_of_attempts)
2886
2906
 
2887
2907
  @GeneralUtilities.check_arguments
@@ -38,9 +38,9 @@ class TFCPS_CodeUnitSpecific_Docker_Functions(TFCPS_CodeUnitSpecific_Base):
38
38
  args.append("--load")
39
39
  args.append(".")
40
40
  codeunit_content_folder = codeunit_folder
41
- GeneralUtilities.retry_action(lambda a=args, f=codeunit_content_folder: self._protected_sc.run_program_argsasarray("docker", a, f, print_errors_as_information=True), 3)
41
+ self._protected_sc.run_program_argsasarray("docker", args, codeunit_content_folder, print_errors_as_information=True,print_live_output=self.get_verbosity()==LogLevel.Debug)
42
42
 
43
- self._protected_sc.run_program_argsasarray("docker", ["save", "--output", f"{codeunitname}_v{codeunitversion}_{GeneralUtilities.platform_to_dash_str(platform)}.tar", f"{codeunitname_lower}:{codeunitversion}"], app_artifacts_folder, print_errors_as_information=True)
43
+ self._protected_sc.run_program_argsasarray("docker", ["save", "--output", f"{codeunitname}_v{codeunitversion}_{GeneralUtilities.platform_to_dash_str(platform)}.tar", f"{codeunitname_lower}:{codeunitversion}"], app_artifacts_folder, print_errors_as_information=True,print_live_output=self.get_verbosity()==LogLevel.Debug)
44
44
  self.__generate_sbom_for_docker_image()
45
45
  self.copy_source_files_to_output_directory()
46
46
 
@@ -93,7 +93,7 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
93
93
  self._protected_sc.run_program("dotnet", "clean", csproj_file_folder)
94
94
  GeneralUtilities.ensure_directory_exists(outputfolder)
95
95
  self._protected_sc.run_program("dotnet", "restore", codeunit_folder,print_live_output=self.get_verbosity()==LogLevel.Debug)
96
- self._protected_sc.run_program_argsasarray("dotnet", ["build", csproj_file_name, "-c", dotnet_build_configuration, "-o", outputfolder, "--runtime", runtime], csproj_file_folder,print_live_output=self.get_verbosity()==4)
96
+ self._protected_sc.run_program_argsasarray("dotnet", ["build", csproj_file_name, "-c", dotnet_build_configuration, "-o", outputfolder, "--runtime", runtime], csproj_file_folder,print_live_output=self.get_verbosity()==LogLevel.Debug)
97
97
  if copy_license_file_to_target_folder:
98
98
  license_file = os.path.join(repository_folder, "License.txt")
99
99
  target = os.path.join(outputfolder, f"{codeunit_name}.License.txt")
@@ -122,7 +122,7 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
122
122
 
123
123
  @GeneralUtilities.check_arguments
124
124
  def standardized_tasks_build_for_dotnet_library_project(self,runtimes:list[str]) -> None:
125
- self.__standardized_tasks_build_for_dotnet_project( runtimes)
125
+ self.__standardized_tasks_build_for_dotnet_project(runtimes)
126
126
  self.__standardized_tasks_build_nupkg_for_dotnet_create_package(runtimes)
127
127
 
128
128
 
@@ -425,7 +425,7 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
425
425
  if os.path.isfile(os.path.join(codeunit_folder, runsettings_file)):
426
426
  arg = f"{arg} --settings {runsettings_file}"
427
427
  arg = f"{arg} /p:CollectCoverage=true /p:CoverletOutput=../Other/Artifacts/TestCoverage/Testcoverage /p:CoverletOutputFormat=cobertura"
428
- self._protected_sc.run_with_epew_with_retry("dotnet", arg, codeunit_folder, print_live_output=self.get_verbosity()==LogLevel.Debug,timeoutInSeconds=600*20)
428
+ self._protected_sc.run_program("dotnet", arg, codeunit_folder, print_live_output=self.get_verbosity()==LogLevel.Debug,timeoutInSeconds=60*20)
429
429
  target_file = os.path.join(coverage_file_folder, "TestCoverage.xml")
430
430
  GeneralUtilities.ensure_file_does_not_exist(target_file)
431
431
  os.rename(os.path.join(coverage_file_folder, "Testcoverage.cobertura.xml"), target_file)
@@ -18,13 +18,13 @@ class TFCPS_CodeUnitSpecific_NodeJS_Functions(TFCPS_CodeUnitSpecific_Base):
18
18
 
19
19
  @GeneralUtilities.check_arguments
20
20
  def build(self) -> None:
21
- self._protected_sc.run_with_epew("npm", "run build", self.get_codeunit_folder(),print_live_output=self._protected_sc.log.loglevel==LogLevel.Diagnostic,encode_argument_in_base64=True)
21
+ self._protected_sc.run_with_epew("npm", "run build", self.get_codeunit_folder(),print_live_output=self.get_verbosity()==LogLevel.Debug,encode_argument_in_base64=True)
22
22
  self.standardized_tasks_build_bom_for_node_project()
23
23
  self.copy_source_files_to_output_directory()
24
24
 
25
25
  @GeneralUtilities.check_arguments
26
26
  def linting(self) -> None:
27
- self._protected_sc.run_with_epew("npm", "run lint", self.get_codeunit_folder(),print_live_output=self._protected_sc.log.loglevel==LogLevel.Diagnostic,encode_argument_in_base64=True)
27
+ self._protected_sc.run_with_epew("npm", "run lint", self.get_codeunit_folder(),print_live_output=self.get_verbosity()==LogLevel.Debug,encode_argument_in_base64=True)
28
28
 
29
29
  @GeneralUtilities.check_arguments
30
30
  def do_common_tasks(self,current_codeunit_version:str)-> None:
@@ -51,7 +51,7 @@ class TFCPS_CodeUnitSpecific_NodeJS_Functions(TFCPS_CodeUnitSpecific_Base):
51
51
  repository_folder = os.path.dirname(codeunit_folder)
52
52
 
53
53
  # run testcases
54
- self._protected_sc.run_with_epew_with_retry("npm", f"run test-{self.get_target_environment_type()}", self.get_codeunit_folder(),print_live_output=self._protected_sc.log.loglevel==LogLevel.Diagnostic,encode_argument_in_base64=True)
54
+ self._protected_sc.run_with_epew("npm", f"run test-{self.get_target_environment_type()}", self.get_codeunit_folder(),print_live_output=self.get_verbosity()==LogLevel.Debug,encode_argument_in_base64=True)
55
55
 
56
56
  # rename file
57
57
  coverage_folder = os.path.join(codeunit_folder, "Other", "Artifacts", "TestCoverage")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ScriptCollection
3
- Version: 4.2.63
3
+ Version: 4.2.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
@@ -9,7 +9,7 @@ ScriptCollection/ProgramRunnerMock.py,sha256=uTu-aFle1W_oKjeQEmuPsFPQpvo0kRf2FrR
9
9
  ScriptCollection/ProgramRunnerPopen.py,sha256=BPY7-ZMIlqT7JOKz8qlB5c0laF2Js-ijzqk09GxZC48,3821
10
10
  ScriptCollection/ProgramRunnerSudo.py,sha256=_khC3xuTdrPoLluBJZWfldltmmuKltABJPcbjZSFW-4,4835
11
11
  ScriptCollection/SCLog.py,sha256=8TRy1LeYMsPOIuWUcnUNNbO5pd-cNBS-3cn-kdzP8FU,4768
12
- ScriptCollection/ScriptCollectionCore.py,sha256=NLyAOUDNO50aPdyCLxiougxEvCW2pScNc_9twGu7MOQ,176461
12
+ ScriptCollection/ScriptCollectionCore.py,sha256=g7rl1IK-jGTRF8HzPDzblNIPmzuUFOsnRQKKyWleTS0,177453
13
13
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  ScriptCollection/OCIImages/AbstractImageHandler.py,sha256=83qDMILwxhH9DbC0sb358Vu8PXEysmJJyap_6gECZqs,1627
15
15
  ScriptCollection/OCIImages/OCIImageManager.py,sha256=aBogkSXNDyi8NO11N-s03nuFJEv7PyJ-wjHuYYeZfvs,6662
@@ -32,23 +32,23 @@ ScriptCollection/TFCPS/TFCPS_MergeToStable.py,sha256=Ajfy2pLajTuU6UpwItHt4C2a-gL
32
32
  ScriptCollection/TFCPS/TFCPS_PreBuildCodeunitsScript.py,sha256=f0Uq1cA_4LvmL72cal0crrbKF6PcxL13D9wBKuQ1YBw,2328
33
33
  ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=9HhVAcCOHoqR8MG1aYdDWKW66qdsEclcdJkyvSJ9ikA,98448
34
34
  ScriptCollection/TFCPS/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
- ScriptCollection/TFCPS/Docker/TFCPS_CodeUnitSpecific_Docker.py,sha256=xMuj-GoEwDnmUWbmdF536dNQL7jnTaw9aQ-gcDqUkgQ,11743
35
+ ScriptCollection/TFCPS/Docker/TFCPS_CodeUnitSpecific_Docker.py,sha256=BA1OWaKERBDp-DmarQ_nDBkIUymxOWXlG1-osGGXR44,11802
36
36
  ScriptCollection/TFCPS/Docker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationBase.py,sha256=bT6Gd5pQpZCw4OQz6HWkPCSn5z__eUUEisABLDSxd0o,200
38
38
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationGenerate.py,sha256=QyjOfMY22JWCvKjMelHiDWbJiWqotOfebpJpgDUaoO4,237
39
39
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationNoGenerate.py,sha256=i0zEGehj0sttxjjZtoq2KFSKp_ulxVyWp_ZgAhIY_So,241
40
- ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=PktP8GpAYvpeU7ipXljHC-Ej9T2imcCxg6o0Huak7EA,31995
40
+ ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=W957xFs4YBkWtU8q-JcbN4aWK2Aq8SIM1jePQRRbEkA,31993
41
41
  ScriptCollection/TFCPS/DotNet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
42
  ScriptCollection/TFCPS/Flutter/TFCPS_CodeUnitSpecific_Flutter.py,sha256=U8oBAOLR2vJpVfc9631Rhb8a04nrnjUMMX-U7pvXjok,7342
43
43
  ScriptCollection/TFCPS/Flutter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
44
  ScriptCollection/TFCPS/Go/TFCPS_CodeUnitSpecific_Go.py,sha256=kyx26AnT1-LySFA46wfJ9yZUKYdMWTD0U2XZfSQbuB0,3497
45
45
  ScriptCollection/TFCPS/Go/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
- ScriptCollection/TFCPS/NodeJS/TFCPS_CodeUnitSpecific_NodeJS.py,sha256=kL37qJNwH6E-CAJqcHbdnc0K0uGjHQ8XD1RXZOdcw1M,12850
46
+ ScriptCollection/TFCPS/NodeJS/TFCPS_CodeUnitSpecific_NodeJS.py,sha256=5xIwcd1cDI1NDrbX5q9MVnnNLdl6PWDrZUO8xyqWjW8,12791
47
47
  ScriptCollection/TFCPS/NodeJS/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
48
  ScriptCollection/TFCPS/Python/TFCPS_CodeUnitSpecific_Python.py,sha256=KFKDdfV9DFHE5n7TI6m1Ra1Qw2JwL_JQjneBfqcRQ_w,13467
49
49
  ScriptCollection/TFCPS/Python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
- scriptcollection-4.2.63.dist-info/METADATA,sha256=U0XcfHCOeHXgJllYyGgFI5AlSmRqEvUn3SlyQnwg8_o,7690
51
- scriptcollection-4.2.63.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
52
- scriptcollection-4.2.63.dist-info/entry_points.txt,sha256=27XwAJEcaMEc1be0Ec1vKHCbiU4Ziu8jKL-SqsrYOIQ,4680
53
- scriptcollection-4.2.63.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
54
- scriptcollection-4.2.63.dist-info/RECORD,,
50
+ scriptcollection-4.2.65.dist-info/METADATA,sha256=zBgoMvBmMIHLvR2NBI__98ZkNSWvX38HeemGurkhZeg,7690
51
+ scriptcollection-4.2.65.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
52
+ scriptcollection-4.2.65.dist-info/entry_points.txt,sha256=27XwAJEcaMEc1be0Ec1vKHCbiU4Ziu8jKL-SqsrYOIQ,4680
53
+ scriptcollection-4.2.65.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
54
+ scriptcollection-4.2.65.dist-info/RECORD,,