fix: clean version string to show 2.0+g<hash> format

Strip .postN.devN and .dYYYYMMDD suffixes from setuptools-scm version
in __init__.py so the banner displays a clean version like 2.0+g05b5d6dc7.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Justin Bollinger
2026-02-13 22:11:31 -05:00
parent 05b5d6dc7a
commit b56a91fef1
2 changed files with 11 additions and 4 deletions

View File

@@ -1,4 +1,13 @@
# hate_crack package
from hate_crack._version import __version__, __version_tuple__
import re as _re
from hate_crack._version import __version__ as _raw_version
from hate_crack._version import __version_tuple__
# Clean setuptools-scm version for display:
# "2.0.post1.dev0+g05b5d6dc7.d20260214" → "2.0+g05b5d6dc7"
# "2.0.post1.dev1+g1234abc" → "2.0+g1234abc"
# "2.0" → "2.0"
__version__ = _re.sub(r"(\.post\d+\.dev\d+|\.d\d{8})", "", _raw_version)
__all__ = ["__version__", "__version_tuple__"]

View File

@@ -773,10 +773,8 @@ def usage():
def ascii_art():
import re
from hate_crack import __version__
version = re.sub(r"\.d\d{8}$", "", __version__)
print(r"""
___ ___ __ _________ __
@@ -785,7 +783,7 @@ def ascii_art():
\ Y // __ \| | \ ___/ \ \____| | \// __ \\ \___| <
\___|_ /(____ /__| \___ >____\______ /|__| (____ /\___ >__|_ \
\/ \/ \/_____/ \/ \/ \/ \/
Version """ + version + """
Version """ + __version__ + """
""")