Use version from config file as default

Use version from config file as default

Use version from config file as default
This commit is contained in:
Layla 2020-02-27 20:15:37 +00:00
parent be9ad8b05d
commit 182ac9e3e2

View File

@ -19,15 +19,25 @@ def get_tag_version():
logger.debug("Tag expression: " + str(tag_expression))
version = "0.0.0"
# Default version is `0.0.0` or what is found in
version = get_file_version()
# If a version is found in tags, use that the lastest tagged version
tagged_versions = subprocess.Popen(['git','tag','--sort=taggerdate', '-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]
logger.debug("Tag Version: " + str(version))
return version
def get_file_version(config):
version = config.get('bumpversion','current_version')
if not version:
config.set('bumpversion', 'current_version', '0.0.0')
version = '0.0.0'
return version
def get_version(dot=False):
version = get_tag_version()