# This program is placed into the public domain.

__all__ = ('get_version')

from os.path import dirname, isdir, join
import re
from subprocess import CalledProcessError, check_output

version_re = re.compile('^Version: (.+)$', re.M)

def get_version():
    cmd = 'dpkg-parsechangelog -S Version'.split()
    try:
        version = check_output(cmd).decode().strip().split('-')[0]
    except CalledProcessError:
        print('Unable to get version number from git tags')
        exit(1)
    return version


if __name__ == '__main__':
    print(get_version())
