Permalink
6025720 May 11, 2018
1 contributor

Users who have contributed to this file

executable file 26 lines (18 sloc) 498 Bytes
#!/usr/bin/env python3
# Usage:
# ./bin/version
# Prints the current version
from distutils.version import LooseVersion
import subprocess
import sys
import os
import re
def get_version(ref="HEAD"):
describe = call('git describe {}'.format(ref))
parts = LooseVersion(describe).version[:3]
return tuple(parts)
def call(cmd):
_, output = subprocess.getstatusoutput(cmd)
return output
major, minor, patch = get_version()
print("{}.{}.{}".format(major, minor, patch))