summaryrefslogtreecommitdiff
path: root/buildstream/_version.py
diff options
context:
space:
mode:
Diffstat (limited to 'buildstream/_version.py')
-rw-r--r--buildstream/_version.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/buildstream/_version.py b/buildstream/_version.py
index 6aeea18f9..03f946cb8 100644
--- a/buildstream/_version.py
+++ b/buildstream/_version.py
@@ -43,6 +43,7 @@ def get_config():
cfg.VCS = "git"
cfg.style = "pep440"
cfg.tag_prefix = ""
+ cfg.tag_regex = "*.*.*"
cfg.parentdir_prefix = "BuildStream-"
cfg.versionfile_source = "buildstream/_version.py"
cfg.verbose = False
@@ -215,7 +216,7 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
@register_vcs_handler("git", "pieces_from_vcs")
-def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
+def git_pieces_from_vcs(tag_prefix, tag_regex, root, verbose, run_command=run_command):
"""Get version from 'git describe' in the root of the source tree.
This only gets called if the git-archive 'subst' keywords were *not*
@@ -237,7 +238,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
# if there isn't one, this yields HEX[-dirty] (no NUM)
describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty",
"--always", "--long",
- "--match", "%s*" % tag_prefix],
+ "--match", "%s%s" % (tag_prefix, tag_regex)],
cwd=root)
# --long was added in git-1.5.5
if describe_out is None:
@@ -505,7 +506,7 @@ def get_versions():
"date": None}
try:
- pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose)
+ pieces = git_pieces_from_vcs(cfg.tag_prefix, cfg.tag_regex, root, verbose)
return render(pieces, cfg.style)
except NotThisMethod:
pass