Grab tagged version based on .bumpversion.cfg

This commit is contained in:
Layla 2019-11-22 16:57:30 -05:00
parent 116961f1f7
commit 7be7706acc

View File

@ -12,9 +12,13 @@ except ImportError:
DEVNULL = open(os.devnull, 'wb')
def get_tag_version():
config = ConfigParser()
config.read('./.bumpversion.cfg')
tag_expression = config.get('bumpversion','tag_name').replace('{new_version}','[0-9]*.[0-9]*.[0-9]*')
version = "0.0.0"
tagged_versions = subprocess.Popen(['git','tag','-l','[0-9]*.[0-9]*.[0-9]*'],
tagged_versions = subprocess.Popen(['git','tag','-l',tag_expression],
stdout=subprocess.PIPE, stderr=DEVNULL, cwd=".").stdout.read().decode('utf-8').rstrip().split('\n')
if len(tagged_versions) > 0 and tagged_versions[-1] != "":
version = tagged_versions[-1]