diff --git a/build.py b/build.py index 507985d..d086637 100644 --- a/build.py +++ b/build.py @@ -33,7 +33,7 @@ default_task = "dev" name = "ddadevops" MODULE = "not-used" PROJECT_ROOT_PATH = "." -version = "4.0.10-SNAPSHOT" +version = "4.0.10-dev1" summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud" description = __doc__ authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")] diff --git a/src/main/python/ddadevops/domain/build_file.py b/src/main/python/ddadevops/domain/build_file.py index 30ce8fe..350a4a9 100644 --- a/src/main/python/ddadevops/domain/build_file.py +++ b/src/main/python/ddadevops/domain/build_file.py @@ -1,6 +1,7 @@ import json import re from enum import Enum +from typing import Optional from pathlib import Path from .common import Validateable from .version import Version @@ -26,9 +27,10 @@ class BuildFile(Validateable): result += [f"Suffix {self.file_path} is unknown."] return result - def build_file_type(self): + def build_file_type(self) -> Optional[BuildFileType]: + result: Optional[BuildFileType] = None if not self.file_path: - return None + return result config_file_type = self.file_path.suffix match config_file_type: case ".json": @@ -115,7 +117,7 @@ class BuildFile(Validateable): except: raise Exception(f"Version not found in file {self.file_path}") - def get_default_suffix(self) -> Version: + def get_default_suffix(self) -> str: result = "SNAPSHOT" match self.build_file_type(): case BuildFileType.PYTHON: diff --git a/src/main/python/ddadevops/domain/version.py b/src/main/python/ddadevops/domain/version.py index da777f4..2f2096a 100644 --- a/src/main/python/ddadevops/domain/version.py +++ b/src/main/python/ddadevops/domain/version.py @@ -69,38 +69,73 @@ class Version(Validateable): new_version_list = self.version_list.copy() if self.is_snapshot(): return Version( - new_version_list, self.default_snapshot_suffix, snapshot_suffix=tmp_snapshot_suffix, version_str=None + new_version_list, + self.default_snapshot_suffix, + snapshot_suffix=tmp_snapshot_suffix, + version_str=None, ) else: new_version_list[2] += 1 return Version( - new_version_list, self.default_snapshot_suffix, snapshot_suffix=tmp_snapshot_suffix, version_str=None + new_version_list, + self.default_snapshot_suffix, + snapshot_suffix=tmp_snapshot_suffix, + version_str=None, ) def create_patch(self): new_version_list = self.version_list.copy() if self.is_snapshot(): - return Version(new_version_list, self.default_snapshot_suffix, snapshot_suffix=None, version_str=None) + return Version( + new_version_list, + self.default_snapshot_suffix, + snapshot_suffix=None, + version_str=None, + ) else: new_version_list[2] += 1 - return Version(new_version_list, self.default_snapshot_suffix, snapshot_suffix=None, version_str=None) + return Version( + new_version_list, + self.default_snapshot_suffix, + snapshot_suffix=None, + version_str=None, + ) def create_minor(self): new_version_list = self.version_list.copy() if self.is_snapshot() and new_version_list[2] == 0: - return Version(new_version_list, self.default_snapshot_suffix, snapshot_suffix=None, version_str=None) + return Version( + new_version_list, + self.default_snapshot_suffix, + snapshot_suffix=None, + version_str=None, + ) else: new_version_list[2] = 0 new_version_list[1] += 1 - return Version(new_version_list, self.default_snapshot_suffix, snapshot_suffix=None, version_str=None) + return Version( + new_version_list, + self.default_snapshot_suffix, + snapshot_suffix=None, + version_str=None, + ) def create_major(self): new_version_list = self.version_list.copy() if self.is_snapshot() and new_version_list[2] == 0 and new_version_list[1] == 0: - return Version(new_version_list, self.default_snapshot_suffix, snapshot_suffix=None, version_str=None) + return Version( + new_version_list, + self.default_snapshot_suffix, + snapshot_suffix=None, + version_str=None, + ) else: new_version_list[2] = 0 new_version_list[1] = 0 new_version_list[0] += 1 - return Version(new_version_list, self.default_snapshot_suffix, snapshot_suffix=None, version_str=None) - + return Version( + new_version_list, + self.default_snapshot_suffix, + snapshot_suffix=None, + version_str=None, + )