Skip to content

Commit

Permalink
v0.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels committed Jul 15, 2023
2 parents 68509cc + 44d9e3d commit fab2643
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 40 deletions.
4 changes: 2 additions & 2 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
-r ../requirements.txt

pyTooling>=2.12.0
pyTooling >= 5.0.0, < 6.0

# Enforce latest version on ReadTheDocs
sphinx<6.0.0
sphinx < 6.0.0

# Sphinx Extenstions
sphinxcontrib-mermaid>=0.7.1
Expand Down
6 changes: 3 additions & 3 deletions pyVersioning/Configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from ruamel.yaml import YAML
from pyTooling.Decorators import export
from pyTooling.MetaClasses import ExtendedType
from pyTooling.Versioning import SemVersion
from pyTooling.Versioning import SemanticVersion


@export
Expand All @@ -53,14 +53,14 @@ class Configuration(Base, metaclass=ExtendedType):
class Project(Base):
name: str
variant: str
version: SemVersion
version: SemanticVersion

def __init__(self, root: 'Base', parent: 'Base', settings: Dict):
super().__init__(root, parent)

self.name = settings["name"]
self.variant = settings["variant"] if "variant" in settings else None
self.version = SemVersion(settings["version"]) if "version" in settings else None
self.version = SemanticVersion(settings["version"]) if "version" in settings else None

class Build(Base):
class Compiler(Base):
Expand Down
2 changes: 1 addition & 1 deletion pyVersioning/Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(self, command: str, errorMessage: str):


@export
class GitHelper:
class GitHelper(metaclass=ExtendedType, mixin=True):
__GIT_SHOW_COMMAND_TO_FORMAT_LOOKUP = {
GitShowCommand.CommitHash: "%H",
GitShowCommand.CommitDateTime: "%ct",
Expand Down
42 changes: 21 additions & 21 deletions pyVersioning/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
__email__ = "[email protected]"
__copyright__ = "2020-2023, Patrick Lehmann"
__license__ = "Apache License, Version 2.0"
__version__ = "0.10.0"
__version__ = "0.11.0"
__keywords__ = ["Python3", "Template", "Versioning", "Git"]

from dataclasses import dataclass, make_dataclass, field
Expand All @@ -44,7 +44,7 @@
from typing import Union, Any, Dict

from pyTooling.Decorators import export
from pyTooling.Versioning import SemVersion
from pyTooling.Versioning import SemanticVersion
from pyTooling.TerminalUI import ILineTerminal

from pyVersioning.Utils import SelfDescriptive, GitHelper, GitShowCommand
Expand All @@ -61,11 +61,11 @@ class Tool(SelfDescriptive):
"""This data structure class describes the tool name and version of pyVersioning."""

_name: str
_version: SemVersion
_version: SemanticVersion

_public = ["name", "version"]

def __init__(self, name: str, version: SemVersion):
def __init__(self, name: str, version: SemanticVersion):
self._name = name
self._version = version

Expand All @@ -74,7 +74,7 @@ def name(self) -> str:
return self._name

@property
def version(self) -> SemVersion:
def version(self) -> SemanticVersion:
return self._version

def __str__(self) -> str:
Expand Down Expand Up @@ -162,22 +162,22 @@ def __post_init__(self) -> None:
class Project(SelfDescriptive):
_name: str
_variant: str
_version: SemVersion
_version: SemanticVersion

_public = ["name", "variant", "version"]

def __init__(self, name: str, version: Union[str, SemVersion] = None, variant: str = None) -> None:
def __init__(self, name: str, version: Union[str, SemanticVersion] = None, variant: str = None) -> None:
"""Assign fields and convert version string to a `Version` object."""

self._name = name if name is not None else ""
self._variant = variant if variant is not None else ""

if isinstance(version, SemVersion):
if isinstance(version, SemanticVersion):
self._version = version
elif isinstance(version, str):
self._version = SemVersion(version)
self._version = SemanticVersion(version)
elif version is None:
self._version = SemVersion(0, 0, 0)
self._version = SemanticVersion(0, 0, 0)

@property
def name(self) -> str:
Expand All @@ -188,7 +188,7 @@ def variant(self) -> str:
return self._variant

@property
def version(self) -> SemVersion:
def version(self) -> SemanticVersion:
return self._version

def __str__(self) -> str:
Expand All @@ -198,32 +198,32 @@ def __str__(self) -> str:
@export
class Compiler(SelfDescriptive):
_name: str
_version: SemVersion
_version: SemanticVersion
_configuration: str
_options: str

_public = ["name", "version", "configuration", "options"]

def __init__(self, name: str, version: Union[str, SemVersion] = "", configuration: str = "", options: str = "") -> None:
def __init__(self, name: str, version: Union[str, SemanticVersion] = "", configuration: str = "", options: str = "") -> None:
"""Assign fields and convert version string to a `Version` object."""

self._name = name if name is not None else ""
self._configuration = configuration if configuration is not None else ""
self._options = options if options is not None else ""

if isinstance(version, SemVersion):
if isinstance(version, SemanticVersion):
self._version = version
elif isinstance(version, str):
self._version = SemVersion(version)
self._version = SemanticVersion(version)
elif version is None:
self._version = SemVersion(0, 0, 0)
self._version = SemanticVersion(0, 0, 0)

@property
def name(self) -> str:
return self._name

@property
def version(self) -> SemVersion:
def version(self) -> SemanticVersion:
return self._version

@property
Expand Down Expand Up @@ -316,7 +316,7 @@ def collectData(self) -> None:
else:
self.service = WorkStation()

self.variables["tool"] = Tool("pyVersioning", SemVersion(__version__))
self.variables["tool"] = Tool("pyVersioning", SemanticVersion(__version__))
self.variables["git"] = self.getGitInformation()
self.variables["env"] = self.getEnvironment()
self.variables["platform"] = self.service.getPlatform()
Expand All @@ -327,11 +327,11 @@ def calculateData(self) -> None:
if self.variables["git"].tag != "":
pass

def getVersion(self, config: Configuration.Project) -> SemVersion:
def getVersion(self, config: Configuration.Project) -> SemanticVersion:
if config.version is not None:
return config.version
else:
return SemVersion("0.0.0")
return SemanticVersion("0.0.0")

def getGitInformation(self) -> Git:
return Git(
Expand Down Expand Up @@ -511,7 +511,7 @@ def getBuild(self, config: Configuration.Build) -> Build:
def getCompiler(self, config: Configuration.Build.Compiler) -> Compiler:
return Compiler(
name=config.name,
version=SemVersion(config.version),
version=SemanticVersion(config.version),
configuration=config.configuration,
options=config.options
)
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[build-system]
requires = [
"pyTooling >= 2.12.0",
"setuptools >= 62.3.3",
"wheel >= 0.38.1"
"pyTooling >= 5.0.0",
"setuptools >= 68.0.0",
"wheel >= 0.40.0"
]
build-backend = "setuptools.build_meta"

Expand Down
7 changes: 3 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ruamel.yaml>=0.17.18
ruamel.yaml >= 0.17.18

pyTooling>=2.12.1
pyTooling.TerminalUI>=1.5.9
pyAttributes>=2.5.1
pyTooling >= 5.0.0, < 6.0
pyAttributes >= 2.5.1
2 changes: 1 addition & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ pytest>=7.2.1
pytest-cov>=4.0.0

# Static Type Checking
mypy>=1.0.0
mypy>=1.2.0
lxml>=4.9
10 changes: 5 additions & 5 deletions tests/unit/Database.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"""Unit tests for project information."""
from unittest import TestCase

from pyTooling.Versioning import SemVersion
from pyTooling.Versioning import SemanticVersion

from pyVersioning import Project as pyV_Project

Expand All @@ -51,7 +51,7 @@ def test_ProjectName(self):

self.assertEqual(project.name, name)
self.assertEqual(project.variant, variant)
self.assertEqual(project.version, SemVersion("0.0.0"))
self.assertEqual(project.version, SemanticVersion("0.0.0"))

def test_ProjectName_VariantName(self):
name = "Project 1"
Expand All @@ -61,7 +61,7 @@ def test_ProjectName_VariantName(self):

self.assertEqual(project.name, name)
self.assertEqual(project.variant, variant)
self.assertEqual(project.version, SemVersion("0.0.0"))
self.assertEqual(project.version, SemanticVersion("0.0.0"))

def test_ProjectName_VersionAsString(self):
name = "Project 1"
Expand All @@ -72,12 +72,12 @@ def test_ProjectName_VersionAsString(self):

self.assertEqual(project.name, name)
self.assertEqual(project.variant, variant)
self.assertEqual(project.version, SemVersion(version))
self.assertEqual(project.version, SemanticVersion(version))

def test_ProjectName_VersionAsVersion(self):
name = "Project 1"
variant = ""
version = SemVersion("1.3.2")
version = SemanticVersion("1.3.2")

project = pyV_Project(name, version)

Expand Down

0 comments on commit fab2643

Please sign in to comment.