diff options
Diffstat (limited to 'src/hydrilla/versions.py')
-rw-r--r-- | src/hydrilla/versions.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/hydrilla/versions.py b/src/hydrilla/versions.py index dcebaa2..065ccca 100644 --- a/src/hydrilla/versions.py +++ b/src/hydrilla/versions.py @@ -35,6 +35,11 @@ from __future__ import annotations import typing as t +from itertools import takewhile + +from . import _version + + VerTuple = t.NewType('VerTuple', 'tuple[int, ...]') def normalize(ver: t.Sequence[int]) -> VerTuple: @@ -66,3 +71,8 @@ def version_string(ver: VerTuple, rev: t.Optional[int] = None) -> str: 1.2.3-5 """ return '.'.join(str(n) for n in ver) + ('' if rev is None else f'-{rev}') + +haketilo_version = normalize(tuple(takewhile( + lambda i: isinstance(i, int), + _version.version_tuple # type: ignore +))) |