ScriptCollection 4.3.17__py3-none-any.whl → 4.3.19__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.
@@ -1526,30 +1526,38 @@ class GeneralUtilities:
1526
1526
  @check_arguments
1527
1527
  def get_current_platform() -> Platform:
1528
1528
  system = platform.system().lower()
1529
- machine = platform.machine().lower()
1529
+ arch = platform.machine().lower()
1530
1530
 
1531
- if system == "windows" and machine in ("x86_64", "amd64"):
1531
+ if system == "windows" and GeneralUtilities. system_is_x64(arch):
1532
1532
  return Platform.Windows_AMD64
1533
- elif system == "linux" and machine in ("x86_64", "amd64"):
1533
+ elif system == "linux" and GeneralUtilities.system_is_x64(arch):
1534
1534
  return Platform.Linux_AMD64
1535
- elif system == "linux" and machine in ("arm64", "aarch64"):
1535
+ elif system == "linux" and GeneralUtilities.system_is_arm64(arch):
1536
1536
  return Platform.Linux_ARM64
1537
- elif system == "darwin" and machine in ("x86_64", "amd64"):
1537
+ elif system == "darwin" and GeneralUtilities.system_is_arm64(arch):
1538
1538
  return Platform.MacOS_ARM64
1539
1539
  else:
1540
- raise ValueError(f"Unsupported platform: {system}/{machine}")
1540
+ raise ValueError(f"Unsupported platform: {system}/{arch}")
1541
1541
 
1542
1542
  @staticmethod
1543
1543
  @check_arguments
1544
1544
  def current_system_is_x64():
1545
- arch = platform.machine().lower()
1545
+ return GeneralUtilities.system_is_x64(platform.machine().lower())
1546
+
1547
+ @staticmethod
1548
+ @check_arguments
1549
+ def system_is_x64(arch:str):
1546
1550
  return arch in ("x86_64", "amd64")
1547
1551
 
1548
1552
  @staticmethod
1549
1553
  @check_arguments
1550
1554
  def current_system_is_arm64():
1551
- arch = platform.machine().lower()
1552
- return arch in ("arm", "aarch64")
1555
+ return GeneralUtilities.system_is_arm64(platform.machine().lower())
1556
+
1557
+ @staticmethod
1558
+ @check_arguments
1559
+ def system_is_arm64(arch:str):
1560
+ return arch in ("arm", "arm64", "aarch64")
1553
1561
 
1554
1562
  @staticmethod
1555
1563
  @check_arguments
@@ -37,7 +37,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
37
37
  from .ProgramRunnerPopen import ProgramRunnerPopen
38
38
  from .SCLog import SCLog, LogLevel
39
39
 
40
- version = "4.3.17"
40
+ version = "4.3.19"
41
41
  __version__ = version
42
42
 
43
43
  class VSCodeWorkspaceShellTask:
@@ -931,10 +931,20 @@ class ScriptCollectionCore:
931
931
  self.git_create_tag(repository, commit_id_new, tag, sign, message)
932
932
 
933
933
  @GeneralUtilities.check_arguments
934
- def get_current_git_branch_has_tag(self, repository_folder: str) -> bool:
934
+ def get_current_git_commit_has_tag(self, repository_folder: str) -> bool:
935
+ # Returns whether the currently checked-out commit (HEAD) itself has a tag.
936
+ # "git tag --points-at HEAD" lists all tags (annotated and lightweight) that point exactly at HEAD;
937
+ # this is not the same as "a tag is reachable from HEAD" (for that see get_latest_git_tag/git_repository_has_tags).
935
938
  self.is_git_or_bare_git_repository(repository_folder)
936
- result = self.run_program_argsasarray("git", ["describe", "--tags", "--abbrev=0"], repository_folder, throw_exception_if_exitcode_is_not_zero=False)
937
- return result[0] == 0
939
+ result = self.run_program_argsasarray("git", ["tag", "--points-at", "HEAD"], repository_folder, throw_exception_if_exitcode_is_not_zero=False)
940
+ return result[0] == 0 and GeneralUtilities.string_has_content(result[1])
941
+
942
+ @GeneralUtilities.check_arguments
943
+ def git_repository_has_tags(self, repository_folder: str) -> bool:
944
+ # Returns whether the repository contains at least one tag (regardless of the currently checked-out commit).
945
+ self.is_git_or_bare_git_repository(repository_folder)
946
+ result = self.run_program_argsasarray("git", ["tag"], repository_folder, throw_exception_if_exitcode_is_not_zero=False)
947
+ return result[0] == 0 and GeneralUtilities.string_has_content(result[1])
938
948
 
939
949
  @GeneralUtilities.check_arguments
940
950
  def get_latest_git_tag(self, repository_folder: str) -> str:
@@ -2375,14 +2385,24 @@ class ScriptCollectionCore:
2375
2385
  def get_semver_version_from_gitversion(self, repository_folder: str) -> str:
2376
2386
  self.assert_is_git_repository(repository_folder)
2377
2387
  if (self.git_repository_has_commits(repository_folder)):
2378
- result = self.get_version_from_gitversion(repository_folder, "MajorMinorPatch")
2379
- if self.git_repository_has_uncommitted_changes(repository_folder):
2380
- if self.get_current_git_branch_has_tag(repository_folder):
2381
- id_of_latest_tag = self.git_get_commit_id(repository_folder, self.get_latest_git_tag(repository_folder))
2382
- current_commit = self.git_get_commit_id(repository_folder)
2383
- current_commit_is_on_latest_tag = id_of_latest_tag == current_commit
2384
- if current_commit_is_on_latest_tag:
2385
- result = self.increment_version(result, False, False, True)
2388
+ has_tags=self.git_repository_has_tags(repository_folder)
2389
+ if has_tags:
2390
+ repo_has_uncommitted_changes=self.git_repository_has_uncommitted_changes(repository_folder)
2391
+ current_commit_is_on_tag=self.get_current_git_commit_has_tag(repository_folder)
2392
+ current_branch_name:str=self.git_get_current_branch_name(repository_folder)
2393
+ latest_version_tag=self.get_latest_git_tag(repository_folder)
2394
+ current_version=latest_version_tag[1:]#remove "v"-prefix
2395
+ if current_branch_name in ("main", "master", "stable"):
2396
+ GeneralUtilities.assert_condition(not repo_has_uncommitted_changes, f"Repository '{repository_folder}' is on branch '{current_branch_name}' and has uncommitted changes. This is not allowed.")
2397
+ GeneralUtilities.assert_condition(current_commit_is_on_tag, f"Repository '{repository_folder}' does not have a tag. This is not allowed.")
2398
+ result = current_version
2399
+ else:
2400
+ if current_commit_is_on_tag and not repo_has_uncommitted_changes:
2401
+ result = current_version
2402
+ else:
2403
+ result = self.get_version_from_gitversion(repository_folder, "MajorMinorPatch")
2404
+ else:
2405
+ result = "0.1.0"
2386
2406
  else:
2387
2407
  result = "0.1.0"
2388
2408
  return result
@@ -2420,7 +2440,7 @@ class ScriptCollectionCore:
2420
2440
  # /nofetch and /nonormalize: avoid network calls / branch normalization (no auth, no DNS, deterministic in containers and offline).
2421
2441
  # called twice as workaround for issue 1877 in gitversion ( https://github.com/GitTools/GitVersion/issues/1877 )
2422
2442
  # timeoutInSeconds: gitversion finishes within seconds on a normal repository; enforce a timeout so a hanging gitversion-process (observed in some build-containers) aborts the build instead of waiting forever.
2423
- gitversion_timeout_in_seconds: int = 300
2443
+ gitversion_timeout_in_seconds: int = 30
2424
2444
  result = self.run_program_argsasarray("gitversion", ["/nofetch", "/nonormalize", "/showVariable", variable], folder, timeoutInSeconds=gitversion_timeout_in_seconds)
2425
2445
  result = self.run_program_argsasarray("gitversion", ["/nofetch", "/nonormalize", "/showVariable", variable], folder, timeoutInSeconds=gitversion_timeout_in_seconds)
2426
2446
  result = GeneralUtilities.strip_new_line_character(result[1])
@@ -197,7 +197,7 @@ class TFCPS_CodeUnit_BuildCodeUnits:
197
197
 
198
198
  test=True#TODO remove this
199
199
  if test:
200
- scbuildcodeunits_arguments=["bash","-c", "pip3 install scriptcollection --upgrade && scshowversion "+" ".join(scbuildcodeunits_arguments)]
200
+ scbuildcodeunits_arguments=["bash","-c", "pip3 install scriptcollection --upgrade && scshowversion && "+" ".join(scbuildcodeunits_arguments)]
201
201
 
202
202
  #run scbuildcodeunits inside the SCBuilder-image. the repository is mounted into the container and the docker-socket is forwarded because codeunit-builds often start containers (for example local test-services).
203
203
  docker_arguments = [
@@ -526,7 +526,7 @@ class TFCPS_Tools_General:
526
526
  target_file_dark = os.path.join(target_folder, "DiffReportDark.html").replace("\\", "/")
527
527
  src = "4b825dc642cb6eb9a060e54bf8d69288fbee4904" # hash/id of empty git-tree
528
528
  src_prefix = "Begin"
529
- if self.__sc.get_current_git_branch_has_tag(repository_folder):
529
+ if self.__sc.git_repository_has_tags(repository_folder):
530
530
  latest_tag = self.__sc.get_latest_git_tag(repository_folder)
531
531
  src = self.__sc.git_get_commit_id(repository_folder, latest_tag)
532
532
  src_prefix = latest_tag
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scriptcollection
3
- Version: 4.3.17
3
+ Version: 4.3.19
4
4
  Summary: The ScriptCollection is the place for reusable scripts.
5
5
  Author-email: Marius Göcke <marius.goecke@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/anionDev/ScriptCollection
@@ -1,7 +1,7 @@
1
1
  ScriptCollection/AnionBuildPlatform.py,sha256=GP-jnb1GbvT8jzlH-cqnxgOzBzeUdiaWnDXtKNjsxiA,12153
2
2
  ScriptCollection/CertificateUpdater.py,sha256=dR5JpJDlZdjD4_pgMz7zCrt1IM7VfatmK6pULSczxQw,9693
3
3
  ScriptCollection/Executables.py,sha256=DHutD8oaI2g71LV-rZ75gg1h4JywoRCKQDLobWPYS5A,66665
4
- ScriptCollection/GeneralUtilities.py,sha256=bz_DRyivll4Fdkao72nDVXb1x6aIz7c1AYdpNL1Lh1U,71345
4
+ ScriptCollection/GeneralUtilities.py,sha256=qYhrKkwbEewGIppuxYRmGhLP50C443tw7sBlwH7Mkbc,71606
5
5
  ScriptCollection/HTTPMaintenanceOverheadHelper.py,sha256=TToNtyO1XzsMbBsTBf3o0xgOK0v4Jf03qw2Z0xb2nCk,2007
6
6
  ScriptCollection/ProcessesRunner.py,sha256=yYaC95h40uszuZPggn2kK3qXIN2ZjGMCavo-NQ53ElQ,1537
7
7
  ScriptCollection/ProgramRunnerBase.py,sha256=eZenpiIFW1dhvSVCG7cfBs5hO4_KLlOxR7oXoSxUDmk,2286
@@ -9,7 +9,7 @@ ScriptCollection/ProgramRunnerMock.py,sha256=uTu-aFle1W_oKjeQEmuPsFPQpvo0kRf2FrR
9
9
  ScriptCollection/ProgramRunnerPopen.py,sha256=zVD-gZY85o8wiGFcpYAGNDl-tXaKzipl1Bkhqy2ois4,4681
10
10
  ScriptCollection/ProgramRunnerSudo.py,sha256=RXsiceQ8W6a8YDk_2BPscVbIAmDIpIxqe9WHBy2r4CM,5233
11
11
  ScriptCollection/SCLog.py,sha256=LdzSJy3NnnwYCCefz2h4tiTy4BjT8lOz3IBG_bMOg9E,4821
12
- ScriptCollection/ScriptCollectionCore.py,sha256=qO2z5PaemMdaw6g1PIx84ViPI1SI3Us7s5TugGM_X24,230165
12
+ ScriptCollection/ScriptCollectionCore.py,sha256=qepijVe-7O3FHy2GSbV8tSeT66ElNCTJgEs3sQ0gn0A,231731
13
13
  ScriptCollection/UnassignedVariablesCheck.py,sha256=v59qLQ5RRvx31ouuCW7NWZj3McWENvGBPkV5ZGBmqJE,4344
14
14
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  ScriptCollection/OCIImages/AbstractImageHandler.py,sha256=o129UYDtLymCRjMZBP9Puaj19ueMHoNt6UTLspfnaRc,1758
@@ -35,14 +35,14 @@ ScriptCollection/Resources/MaintenanceSite/MaintenanceSite.html,sha256=CX9S1bdOz
35
35
  ScriptCollection/TFCPS/SCTaskRunnerServer.py,sha256=rpuwSsQ6YQfZS2LGnvOH5ql8zs_-cHU4LQttS7XNT60,11272
36
36
  ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=oICRtl85n2puWvchcJIkmLZL1BAylMbzH7ltBGWfqgY,31973
37
37
  ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py,sha256=Ll5EOkpVpPiFrM2mLeQXolaF7075IwgtnHXvfdpkH4k,9904
38
- ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=xvix1XAbcNmJ0AybZwSTaWMs6k9Rs6yAx9Ntc0_hwlA,29119
38
+ ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=YqGlKah7N7iU2OBlxtukH0F0ZCyz56psxEfu0Y5UGvA,29122
39
39
  ScriptCollection/TFCPS/TFCPS_CreateRelease.py,sha256=X2NgZgbOkJsdZ6wMHB_RuS_rQCuz5oQCqzYrxyXBN9Q,6680
40
40
  ScriptCollection/TFCPS/TFCPS_Generic.py,sha256=5vCFfDiU8bvfcnoKNs2ATS8nsl6mYXcIuX7XfYE0tvg,2116
41
41
  ScriptCollection/TFCPS/TFCPS_MergeToMain.py,sha256=zp7n0Li7GTi4tERDMgDcJ-o3m6131m31zvkat0lALEc,7781
42
42
  ScriptCollection/TFCPS/TFCPS_MergeToStable.py,sha256=jQ0B3yq45we-8a0KuNFMfXCk9MfzPpTv2QgDWMN34x4,22792
43
43
  ScriptCollection/TFCPS/TFCPS_PreBuildCodeunitsScript.py,sha256=JYiDqDsfVJQWS9xWMi_UzfXnXsJRnPRxAzFr82bUEvI,2370
44
44
  ScriptCollection/TFCPS/TFCPS_RemoteBuild.py,sha256=Z8Gw-j5I7VPafHEsVeQJ2gTTKVLAnnhwZhY8IVTi2Qk,11867
45
- ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=HtIpLK9AaIzvLB_nOC8vPKosuwgi_7XV0xoZxut9AFs,126278
45
+ ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=di4RRYcKcDEKRfyEsrSMAGxuHSeaqG_v09F4159GzJ0,126271
46
46
  ScriptCollection/TFCPS/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
47
  ScriptCollection/TFCPS/Docker/TFCPS_CodeUnitSpecific_Docker.py,sha256=wS2yzYUmJ4m0cf6cBYVTHsiXSXfYhHoLFFy8x6yEQvY,19573
48
48
  ScriptCollection/TFCPS/Docker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -63,8 +63,8 @@ ScriptCollection/TFCPS/Python/TFCPS_CodeUnitSpecific_Python.py,sha256=Bd1gxCk9Fb
63
63
  ScriptCollection/TFCPS/Python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
64
  ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=WhOsMpJxNGqnQGA3nJ99ruyqymxBeJxCcpK98zJduTo,1680
65
65
  ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
- scriptcollection-4.3.17.dist-info/METADATA,sha256=8jIcBUHlojzB0jsZgX4ciN0MPw5unfNefpfe7-gzikg,7816
67
- scriptcollection-4.3.17.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
68
- scriptcollection-4.3.17.dist-info/entry_points.txt,sha256=MwiP9P29EeSfjS19JOZmqbx8OzpZrUWpgMza3EffBs8,5812
69
- scriptcollection-4.3.17.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
70
- scriptcollection-4.3.17.dist-info/RECORD,,
66
+ scriptcollection-4.3.19.dist-info/METADATA,sha256=Hvd2A0a2Llg_nC0Z9xFXJjarM2o3g_3hx1ztc4KXHRI,7816
67
+ scriptcollection-4.3.19.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
68
+ scriptcollection-4.3.19.dist-info/entry_points.txt,sha256=MwiP9P29EeSfjS19JOZmqbx8OzpZrUWpgMza3EffBs8,5812
69
+ scriptcollection-4.3.19.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
70
+ scriptcollection-4.3.19.dist-info/RECORD,,