ScriptCollection 4.2.62__py3-none-any.whl → 4.2.64__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.62"
40
+ version = "4.2.64"
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):
@@ -1176,7 +1176,7 @@ class TFCPS_Tools_General:
1176
1176
  applicationimage_folder = os.path.join(artifacts_folder, "BuildResult_OCIImage")
1177
1177
  codeunit_version = self.get_version_of_codeunit(os.path.join(codeunit_folder, f"{codeunitname}.codeunit.xml"))
1178
1178
  if remote_image_name is None:
1179
- remote_image_name = codeunitname
1179
+ remote_image_name = codeunitname.lower()
1180
1180
  tar_files=[f for f in GeneralUtilities.get_direct_files_of_folder(applicationimage_folder) if f.endswith(".tar")]
1181
1181
  target_image_address=f"{registry}/{remote_image_name}"
1182
1182
  tar_files_with_platforms: list[tuple[str, str, str]] = []
@@ -1201,6 +1201,7 @@ class TFCPS_Tools_General:
1201
1201
  self.push_docker_build_artifact_as_multi_arch_artifact(tar_files_with_platforms,target_image_address, "v"+codeunit_version)
1202
1202
  self.push_docker_build_artifact_as_multi_arch_artifact(tar_files_with_platforms,target_image_address, "latest")
1203
1203
  if push_readme:
1204
+ GeneralUtilities.assert_file_exists(os.path.join(codeunit_folder, "ReadMe.md"))
1204
1205
  self.__sc.run_program_with_retry("docker-pushrm", target_image_address, codeunit_folder)
1205
1206
 
1206
1207
  def push_docker_build_artifact_as_multi_arch_artifact(self,tar_files: list[tuple[str, str, str]], image_address: str, tag: str):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ScriptCollection
3
- Version: 4.2.62
3
+ Version: 4.2.64
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=TKeOKBIdL-4wCdt__7tN8xBADf2vHxgudGdnswpxAG8,176461
12
+ ScriptCollection/ScriptCollectionCore.py,sha256=x3BSwJfArWxqVQyeZu3ZXIw5ZjnRWhVdQN_Ct-WpsLU,177450
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
@@ -30,7 +30,7 @@ ScriptCollection/TFCPS/TFCPS_Generic.py,sha256=O-0guM_LJCcZmPZJhMgTvXD2RXUJEBWWv
30
30
  ScriptCollection/TFCPS/TFCPS_MergeToMain.py,sha256=-Ev9D3bZDlUk2WFQhcmvzQ3FCS97OdsVUd0koAdmpZc,7474
31
31
  ScriptCollection/TFCPS/TFCPS_MergeToStable.py,sha256=Ajfy2pLajTuU6UpwItHt4C2a-gLF3gPc4z6BktL3Cio,22163
32
32
  ScriptCollection/TFCPS/TFCPS_PreBuildCodeunitsScript.py,sha256=f0Uq1cA_4LvmL72cal0crrbKF6PcxL13D9wBKuQ1YBw,2328
33
- ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=3XOc6eYBfmzpEKmmvpH-kCYymzLj3NRXhgUJXzkUOnI,98348
33
+ ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=9HhVAcCOHoqR8MG1aYdDWKW66qdsEclcdJkyvSJ9ikA,98448
34
34
  ScriptCollection/TFCPS/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
35
  ScriptCollection/TFCPS/Docker/TFCPS_CodeUnitSpecific_Docker.py,sha256=xMuj-GoEwDnmUWbmdF536dNQL7jnTaw9aQ-gcDqUkgQ,11743
36
36
  ScriptCollection/TFCPS/Docker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -47,8 +47,8 @@ ScriptCollection/TFCPS/NodeJS/TFCPS_CodeUnitSpecific_NodeJS.py,sha256=kL37qJNwH6
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.62.dist-info/METADATA,sha256=qK2TKc3JjC_aXbaHw5oWttsm-s3c1D-jqITQJDNqIsU,7690
51
- scriptcollection-4.2.62.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
52
- scriptcollection-4.2.62.dist-info/entry_points.txt,sha256=27XwAJEcaMEc1be0Ec1vKHCbiU4Ziu8jKL-SqsrYOIQ,4680
53
- scriptcollection-4.2.62.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
54
- scriptcollection-4.2.62.dist-info/RECORD,,
50
+ scriptcollection-4.2.64.dist-info/METADATA,sha256=UgOzaIjwaC2sYtjl9CVPDh9WvPjVX12aGE0xwk2xlD4,7690
51
+ scriptcollection-4.2.64.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
52
+ scriptcollection-4.2.64.dist-info/entry_points.txt,sha256=27XwAJEcaMEc1be0Ec1vKHCbiU4Ziu8jKL-SqsrYOIQ,4680
53
+ scriptcollection-4.2.64.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
54
+ scriptcollection-4.2.64.dist-info/RECORD,,