Skip to content

Commit

Permalink
chore: steamline logging in _version_cls
Browse files Browse the repository at this point in the history
  • Loading branch information
RonnyPfannschmidt committed Oct 2, 2023
1 parent 27e1bc3 commit 27aad55
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/setuptools_scm/_version_cls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

from logging import getLogger
from typing import cast
from typing import Type
from typing import Union
Expand All @@ -11,6 +10,9 @@
except ImportError:
from setuptools.extern.packaging.version import InvalidVersion # type: ignore
from setuptools.extern.packaging.version import Version as Version # type: ignore
from . import _log

log = _log.log.getChild("version_cls")


class NonNormalizedVersion(Version):
Expand Down Expand Up @@ -41,10 +43,8 @@ def __repr__(self) -> str:
def _version_as_tuple(version_str: str) -> tuple[int | str, ...]:
try:
parsed_version = Version(version_str)
except InvalidVersion:
log = getLogger(__name__).parent
assert log is not None
log.error("failed to parse version %s", version_str)
except InvalidVersion as e:
log.error("failed to parse version %s: %s", e, version_str)
return (version_str,)
else:
version_fields: tuple[int | str, ...] = parsed_version.release
Expand Down

0 comments on commit 27aad55

Please sign in to comment.