non-version tags don't break the build
This commit is contained in:
parent
d1c308181b
commit
26f5d08567
1 changed files with 12 additions and 2 deletions
|
@ -16,16 +16,26 @@ def main():
|
|||
version = args.version
|
||||
else:
|
||||
tag = subprocess.check_output(['git', 'describe']).strip()
|
||||
version = get_version_from_tag(tag)
|
||||
try:
|
||||
version = get_version_from_tag(tag)
|
||||
except InvalidVersionTag:
|
||||
# this should be an error but its easier to handle here
|
||||
# than in the calling scripts.
|
||||
print 'Tag cannot be converted to a version, Exitting'
|
||||
return
|
||||
set_version(version)
|
||||
|
||||
|
||||
class InvalidVersionTag(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def get_version_from_tag(tag):
|
||||
match = re.match('v([\d.]+)', tag)
|
||||
if match:
|
||||
return match.group(1)
|
||||
else:
|
||||
raise Exception('Failed to parse version from tag {}'.format(tag))
|
||||
raise InvalidVersionTag('Failed to parse version from tag {}'.format(tag))
|
||||
|
||||
|
||||
def set_version(version):
|
||||
|
|
Loading…
Reference in a new issue