ScriptCollection 4.3.37__py3-none-any.whl → 4.3.38__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.
@@ -1217,7 +1217,7 @@ def ShowProjectVersion() -> int:
1217
1217
  args = parser.parse_args()
1218
1218
  repository = GeneralUtilities.resolve_relative_path(args.repository, os.getcwd()) if args.repository is not None else os.getcwd()
1219
1219
  sc: ScriptCollectionCore = ScriptCollectionCore()
1220
- GeneralUtilities.write_message_to_stdout(sc.get_semver_version_from_gitversion(repository))
1220
+ GeneralUtilities.write_message_to_stdout(sc.get_semver_version(repository))
1221
1221
  return 0
1222
1222
 
1223
1223
 
@@ -38,7 +38,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
38
38
  from .ProgramRunnerPopen import ProgramRunnerPopen
39
39
  from .SCLog import SCLog, LogLevel
40
40
 
41
- version = "4.3.37"
41
+ version = "4.3.38"
42
42
  __version__ = version
43
43
 
44
44
  class VSCodeWorkspaceShellTask:
@@ -1641,7 +1641,7 @@ class ScriptCollectionCore:
1641
1641
  def SCCreateSimpleMergeWithoutRelease(self, repository: str, sourcebranch: str, targetbranch: str, remotename: str, remove_source_branch: bool) -> None:
1642
1642
  commitid = self.git_merge(repository, sourcebranch, targetbranch, False, True)
1643
1643
  self.git_merge(repository, targetbranch, sourcebranch, True, True)
1644
- created_version = self.get_semver_version_from_gitversion(repository)
1644
+ created_version = self.get_semver_version(repository)
1645
1645
  self.git_create_tag(repository, commitid, f"v{created_version}", True)
1646
1646
  self.git_push(repository, remotename, targetbranch, targetbranch, False, True)
1647
1647
  if (GeneralUtilities.string_has_nonwhitespace_content(remotename)):
@@ -2489,7 +2489,19 @@ class ScriptCollectionCore:
2489
2489
  return f"{major}.{minor}.{patch}"
2490
2490
 
2491
2491
  @GeneralUtilities.check_arguments
2492
- def get_semver_version_from_gitversion(self, repository_folder: str) -> str:
2492
+ def get_semver_version(self, repository_folder: str) -> str:
2493
+ """
2494
+ Calculates the semantic version of the current state of the given repository.
2495
+ The result is based on the latest git-tag (which is expected to have the format "v<major>.<minor>.<patch>") and the name of the current branch:
2496
+ - If the repository does not have any commits or does not have any tags then the version "0.1.0" is returned.
2497
+ - If the current branch is "main", "master" or "stable" then the repository must not have uncommitted changes and the current commit must be tagged.
2498
+ In this case the version of the tag of the current commit is returned. Otherwise an exception will be thrown.
2499
+ - On all other branches the version of the latest tag is returned as long as the current commit is tagged and the repository does not have uncommitted changes.
2500
+ If the current commit is not tagged or the repository has uncommitted changes then the version of the latest tag will be incremented depending on the name of the current branch:
2501
+ - Branches with the prefix "major/" increase the major-version and reset the minor- and the patch-version to 0.
2502
+ - Branches with the prefix "feature/" increase the minor-version and reset the patch-version to 0.
2503
+ - All other branches increase the patch-version.
2504
+ """
2493
2505
  self.assert_is_git_repository(repository_folder)
2494
2506
  if (self.git_repository_has_commits(repository_folder)):
2495
2507
  has_tags=self.git_repository_has_tags(repository_folder)
@@ -2499,17 +2511,22 @@ class ScriptCollectionCore:
2499
2511
  current_branch_name:str=self.git_get_current_branch_name(repository_folder)
2500
2512
  latest_version_tag=self.get_latest_git_tag(repository_folder)
2501
2513
  current_version=latest_version_tag[1:]#remove "v"-prefix
2514
+ result = current_version
2502
2515
  if current_branch_name in ("main", "master", "stable"):
2503
2516
  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.")
2504
2517
  GeneralUtilities.assert_condition(current_commit_is_on_tag, f"Repository '{repository_folder}' does not have a tag. This is not allowed.")
2505
- result = current_version
2506
2518
  else:
2507
- if current_commit_is_on_tag and not repo_has_uncommitted_changes:
2508
- result = current_version
2509
- else:
2510
- result = self.get_version_from_gitversion(repository_folder, "MajorMinorPatch")
2511
- if current_commit_is_on_tag and repo_has_uncommitted_changes:
2512
- result = self.__get_next_version_from_gitversion(repository_folder, current_branch_name)
2519
+ if not current_commit_is_on_tag or repo_has_uncommitted_changes:
2520
+ if current_branch_name.startswith("major/"):
2521
+ incremented = self.increment_version(current_version, True, False, False)
2522
+ major = incremented.split(".")[0]
2523
+ result = f"{major}.0.0"
2524
+ elif current_branch_name.startswith("feature/"):
2525
+ incremented = self.increment_version(current_version, False, True, False)
2526
+ splitted = incremented.split(".")
2527
+ result = f"{splitted[0]}.{splitted[1]}.0"
2528
+ else:
2529
+ result = self.increment_version(current_version, False, False, True)
2513
2530
  else:
2514
2531
  result = "0.1.0"
2515
2532
  else:
@@ -550,7 +550,7 @@ class TFCPS_Tools_General:
550
550
  @GeneralUtilities.check_arguments
551
551
  def get_version_of_project(self,repositoryfolder:str) -> str:
552
552
  self.__sc.assert_is_git_repository(repositoryfolder)
553
- return self.__sc.get_semver_version_from_gitversion(repositoryfolder)
553
+ return self.__sc.get_semver_version(repositoryfolder)
554
554
 
555
555
  @GeneralUtilities.check_arguments
556
556
  def __try_calculate_changelog_message(self, repositoryfolder: str):
@@ -1702,7 +1702,7 @@ class TFCPS_Tools_General:
1702
1702
  self.__sc.git_fetch(submodule_folder, remote)
1703
1703
  self.__sc.git_checkout(submodule_folder, local_branch)
1704
1704
  self.__sc.git_pull(submodule_folder, remote, local_branch, remote_branch, True)
1705
- current_version = self.__sc.get_semver_version_from_gitversion(repository_folder)
1705
+ current_version = self.__sc.get_semver_version(repository_folder)
1706
1706
  changelog_file = os.path.join(repository_folder, "Other", "Resources", "Changelog", f"v{current_version}.md")
1707
1707
  if (not os.path.isfile(changelog_file)):
1708
1708
  GeneralUtilities.ensure_file_exists(changelog_file)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scriptcollection
3
- Version: 4.3.37
3
+ Version: 4.3.38
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,6 +1,6 @@
1
1
  ScriptCollection/AnionBuildPlatform.py,sha256=GP-jnb1GbvT8jzlH-cqnxgOzBzeUdiaWnDXtKNjsxiA,12153
2
2
  ScriptCollection/CertificateUpdater.py,sha256=dR5JpJDlZdjD4_pgMz7zCrt1IM7VfatmK6pULSczxQw,9693
3
- ScriptCollection/Executables.py,sha256=8rkQIx417g3slWcI7ablJ_euCGJr6Sp52j4vWYy-aYg,67925
3
+ ScriptCollection/Executables.py,sha256=uTdjo_XKTF6L9Xx_HgrnsE4kNP3ahcNR9PCuFuWcJPc,67909
4
4
  ScriptCollection/GeneralUtilities.py,sha256=qYhrKkwbEewGIppuxYRmGhLP50C443tw7sBlwH7Mkbc,71606
5
5
  ScriptCollection/HTTPMaintenanceOverheadHelper.py,sha256=TToNtyO1XzsMbBsTBf3o0xgOK0v4Jf03qw2Z0xb2nCk,2007
6
6
  ScriptCollection/ProcessesRunner.py,sha256=yYaC95h40uszuZPggn2kK3qXIN2ZjGMCavo-NQ53ElQ,1537
@@ -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=_o7kjjo7jKAtPO6ZsXDkPXsTB6bJFSQ8ClK2SXvKHFY,246535
12
+ ScriptCollection/ScriptCollectionCore.py,sha256=S738N-NiplR71ghq0kP5eVy6LaLVPaLvQdBHRmh08Ts,248155
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=WO2M28c2tUwsXFNa2L9zqMhdlyObWm3qpPE0LdIs7SE,2315
@@ -42,7 +42,7 @@ ScriptCollection/TFCPS/TFCPS_MergeToMain.py,sha256=zp7n0Li7GTi4tERDMgDcJ-o3m6131
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=nPk14lYfIMp5Z9lA8yvXZfzZbV3Cby5JCErJH82bsMI,127650
45
+ ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=82RMd3A9kAGT2H3XXLbQNXGwYcGitQnSOBmlsXGDL2g,127618
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.37.dist-info/METADATA,sha256=FA6VPCok158FpMqhQcdcebej2fr7C__296zWmNjQPnI,7816
67
- scriptcollection-4.3.37.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
68
- scriptcollection-4.3.37.dist-info/entry_points.txt,sha256=Iq9YMSTWNCAJpBzM5L9CQx80tL9-XUu6MzDRAdBrIPg,5875
69
- scriptcollection-4.3.37.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
70
- scriptcollection-4.3.37.dist-info/RECORD,,
66
+ scriptcollection-4.3.38.dist-info/METADATA,sha256=NYNwCoir0Ga386JGJOpKVGzx3JpqAurMbcBdjyoLOiQ,7816
67
+ scriptcollection-4.3.38.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
68
+ scriptcollection-4.3.38.dist-info/entry_points.txt,sha256=Iq9YMSTWNCAJpBzM5L9CQx80tL9-XUu6MzDRAdBrIPg,5875
69
+ scriptcollection-4.3.38.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
70
+ scriptcollection-4.3.38.dist-info/RECORD,,