From 77a88aacdb9e4620299116877b978fd8612a4f67 Mon Sep 17 00:00:00 2001 From: sami-m-g Date: Wed, 27 Mar 2024 13:02:00 +0200 Subject: [PATCH] lxmlh/version.py: changed reading VERSION --- lxmlh/version.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lxmlh/version.py b/lxmlh/version.py index a55a28b..f8862c7 100644 --- a/lxmlh/version.py +++ b/lxmlh/version.py @@ -1,18 +1,16 @@ """Version information for lxmlh package.""" -import importlib.metadata -from typing import Union +from typing import Tuple, Union -def _get_version_tuple() -> tuple: +def _get_version_tuple() -> Tuple[Union[int, str]]: def as_integer(string: str) -> Union[int, str]: try: return int(string) except ValueError: # pragma: no cover return string # pragma: no cover - return tuple( - as_integer(v) for v in importlib.metadata.version("lxmlh").strip().split(".") - ) + with open("VERSION", encoding="UTF-8") as versionFile: + return tuple(as_integer(v) for v in versionFile.read().strip()) __version__ = _get_version_tuple()