Skip to content

Commit

Permalink
lxmlh/version.py: changed reading VERSION
Browse files Browse the repository at this point in the history
  • Loading branch information
sami-m-g committed Mar 27, 2024
1 parent a70257f commit 77a88aa
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lxmlh/version.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 77a88aa

Please sign in to comment.