| ... |
... |
@@ -355,6 +355,7 @@ def get_config_from_root(root): |
|
355
|
355
|
cfg.versionfile_source = get(parser, "versionfile_source")
|
|
356
|
356
|
cfg.versionfile_build = get(parser, "versionfile_build")
|
|
357
|
357
|
cfg.tag_prefix = get(parser, "tag_prefix")
|
|
|
358
|
+ cfg.tag_regex = get(parser, "tag_regex") or "*"
|
|
358
|
359
|
if cfg.tag_prefix in ("''", '""'):
|
|
359
|
360
|
cfg.tag_prefix = ""
|
|
360
|
361
|
cfg.parentdir_prefix = get(parser, "parentdir_prefix")
|
| ... |
... |
@@ -463,6 +464,7 @@ def get_config(): |
|
463
|
464
|
cfg.VCS = "git"
|
|
464
|
465
|
cfg.style = "%(STYLE)s"
|
|
465
|
466
|
cfg.tag_prefix = "%(TAG_PREFIX)s"
|
|
|
467
|
+ cfg.tag_regex = "%(TAG_REGEX)s"
|
|
466
|
468
|
cfg.parentdir_prefix = "%(PARENTDIR_PREFIX)s"
|
|
467
|
469
|
cfg.versionfile_source = "%(VERSIONFILE_SOURCE)s"
|
|
468
|
470
|
cfg.verbose = False
|
| ... |
... |
@@ -635,7 +637,7 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose): |
|
635
|
637
|
|
|
636
|
638
|
|
|
637
|
639
|
@register_vcs_handler("git", "pieces_from_vcs")
|
|
638
|
|
-def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
|
|
|
640
|
+def git_pieces_from_vcs(tag_prefix, tag_regex, root, verbose, run_command=run_command):
|
|
639
|
641
|
"""Get version from 'git describe' in the root of the source tree.
|
|
640
|
642
|
|
|
641
|
643
|
This only gets called if the git-archive 'subst' keywords were *not*
|
| ... |
... |
@@ -657,7 +659,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): |
|
657
|
659
|
# if there isn't one, this yields HEX[-dirty] (no NUM)
|
|
658
|
660
|
describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty",
|
|
659
|
661
|
"--always", "--long",
|
|
660
|
|
- "--match", "%%s*" %% tag_prefix],
|
|
|
662
|
+ "--match", "%%s%%s" %% (tag_prefix, tag_regex)],
|
|
661
|
663
|
cwd=root)
|
|
662
|
664
|
# --long was added in git-1.5.5
|
|
663
|
665
|
if describe_out is None:
|
| ... |
... |
@@ -925,7 +927,7 @@ def get_versions(): |
|
925
|
927
|
"date": None}
|
|
926
|
928
|
|
|
927
|
929
|
try:
|
|
928
|
|
- pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose)
|
|
|
930
|
+ pieces = git_pieces_from_vcs(cfg.tag_prefix, cfg.tag_regex, root, verbose)
|
|
929
|
931
|
return render(pieces, cfg.style)
|
|
930
|
932
|
except NotThisMethod:
|
|
931
|
933
|
pass
|
| ... |
... |
@@ -1027,7 +1029,7 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose): |
|
1027
|
1029
|
|
|
1028
|
1030
|
|
|
1029
|
1031
|
@register_vcs_handler("git", "pieces_from_vcs")
|
|
1030
|
|
-def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
|
|
|
1032
|
+def git_pieces_from_vcs(tag_prefix, tag_regex, root, verbose, run_command=run_command):
|
|
1031
|
1033
|
"""Get version from 'git describe' in the root of the source tree.
|
|
1032
|
1034
|
|
|
1033
|
1035
|
This only gets called if the git-archive 'subst' keywords were *not*
|
| ... |
... |
@@ -1049,7 +1051,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): |
|
1049
|
1051
|
# if there isn't one, this yields HEX[-dirty] (no NUM)
|
|
1050
|
1052
|
describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty",
|
|
1051
|
1053
|
"--always", "--long",
|
|
1052
|
|
- "--match", "%s*" % tag_prefix],
|
|
|
1054
|
+ "--match", "%s%s" % (tag_prefix, tag_regex)],
|
|
1053
|
1055
|
cwd=root)
|
|
1054
|
1056
|
# --long was added in git-1.5.5
|
|
1055
|
1057
|
if describe_out is None:
|
| ... |
... |
@@ -1451,7 +1453,7 @@ def get_versions(verbose=False): |
|
1451
|
1453
|
from_vcs_f = handlers.get("pieces_from_vcs")
|
|
1452
|
1454
|
if from_vcs_f:
|
|
1453
|
1455
|
try:
|
|
1454
|
|
- pieces = from_vcs_f(cfg.tag_prefix, root, verbose)
|
|
|
1456
|
+ pieces = from_vcs_f(cfg.tag_prefix, cfg.tag_regex, root, verbose)
|
|
1455
|
1457
|
ver = render(pieces, cfg.style)
|
|
1456
|
1458
|
if verbose:
|
|
1457
|
1459
|
print("got version from VCS %s" % ver)
|
| ... |
... |
@@ -1586,6 +1588,7 @@ def get_cmdclass(): |
|
1586
|
1588
|
{"DOLLAR": "$",
|
|
1587
|
1589
|
"STYLE": cfg.style,
|
|
1588
|
1590
|
"TAG_PREFIX": cfg.tag_prefix,
|
|
|
1591
|
+ "TAG_REGEX": cfg.tag_regex,
|
|
1589
|
1592
|
"PARENTDIR_PREFIX": cfg.parentdir_prefix,
|
|
1590
|
1593
|
"VERSIONFILE_SOURCE": cfg.versionfile_source,
|
|
1591
|
1594
|
})
|
| ... |
... |
@@ -1615,6 +1618,7 @@ def get_cmdclass(): |
|
1615
|
1618
|
{"DOLLAR": "$",
|
|
1616
|
1619
|
"STYLE": cfg.style,
|
|
1617
|
1620
|
"TAG_PREFIX": cfg.tag_prefix,
|
|
|
1621
|
+ "TAG_REGEX": cfg.tag_regex,
|
|
1618
|
1622
|
"PARENTDIR_PREFIX": cfg.parentdir_prefix,
|
|
1619
|
1623
|
"VERSIONFILE_SOURCE": cfg.versionfile_source,
|
|
1620
|
1624
|
})
|
| ... |
... |
@@ -1716,6 +1720,7 @@ def do_setup(): |
|
1716
|
1720
|
f.write(LONG % {"DOLLAR": "$",
|
|
1717
|
1721
|
"STYLE": cfg.style,
|
|
1718
|
1722
|
"TAG_PREFIX": cfg.tag_prefix,
|
|
|
1723
|
+ "TAG_REGEX": cfg.tag_regex,
|
|
1719
|
1724
|
"PARENTDIR_PREFIX": cfg.parentdir_prefix,
|
|
1720
|
1725
|
"VERSIONFILE_SOURCE": cfg.versionfile_source,
|
|
1721
|
1726
|
})
|