fix regex

This commit is contained in:
Amon Khavari 2023-01-13 17:17:03 +01:00
parent 9632918850
commit 23d8932aaf

View file

@ -241,7 +241,7 @@ def get_best_candidate_tag(rev: str, git_repo: str) -> str:
all_tag_cmd = ('git', *NO_FS_MONITOR, 'tag', '-l')
all_tags = cmd_output(*all_tag_cmd, cwd=git_repo)[1].strip().splitlines()
all_tags = sorted(all_tags, key=LooseVersion)
numbers_and_dots = re.compile("^v|\d+(\.\d+)*$")
numbers_and_dots = re.compile("^v?\d+(\.\d+)*$")
filtered_all_tags = [ver for ver in all_tags if numbers_and_dots.match(ver)]
try: # or check for empty list
rev = filtered_all_tags[-1]