Skip to content

Commit

Permalink
enhancement: improve reliability of version templater making sure tha…
Browse files Browse the repository at this point in the history
…t a SemVer compliant version number is passed (#483)

This PR makes it possible to have compliant SemVer versions.
  • Loading branch information
Guts authored Apr 15, 2024
2 parents 3b1cd7a + 7c77188 commit 284d624
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion builder/version_info_templater.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

# Standard library
import argparse
import re
import sys
from os import W_OK, access, path
from pathlib import Path
Expand All @@ -28,13 +29,18 @@
# ########### MAIN #################
# ##################################

# Define a regular expression pattern to match the version string
pattern = re.compile(r"(\d+)\.(\d+)\.(\d+)")
semver = pattern.match(__about__.__version__).groups()


REPLACEMENT_VALUES = {
"[AUTHOR]": __about__.__author__,
"[COPYRIGHT]": __about__.__copyright__,
"[DESCRIPTION]": __about__.__summary__,
"[EXECUTABLE_NAME]": __about__.__executable_name__,
"[TITLE]": __about__.__title__,
"[VERSION_INFO_TUPLE]": "({},{},{},0)".format(*__about__.__version_info__),
"[VERSION_INFO_TUPLE]": "({},{},{},0)".format(*semver),
"[VERSION_SEMVER]": __about__.__version__,
}

Expand Down

0 comments on commit 284d624

Please sign in to comment.