diff options
author | Guido Günther <agx@sigxcpu.org> | 2021-04-28 09:03:28 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2021-04-28 09:15:31 +0200 |
commit | 35d91d5f1dbdeadb49aca1d91184b45aeb43a1b8 (patch) | |
tree | 740987e3b34d027d4907ec9faa7b2d3212e4990b /setup.py | |
parent | 3f8a58c1f48bed0492295e37ddb2318125d9e39c (diff) |
setup.py: Avoid dpkg-parsechangelog
This helps on non-debian systems
Diffstat (limited to 'setup.py')
-rwxr-xr-x | setup.py | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -18,20 +18,20 @@ # END OF COPYRIGHT # import os +import re from setuptools import setup, find_packages -import subprocess VERSION_PY_PATH = 'gbp/version.py' def _parse_changelog(): """Get version from debian changelog and write it to gbp/version.py""" - popen = subprocess.Popen('dpkg-parsechangelog', stdout=subprocess.PIPE) - out, ret = popen.communicate() - for line in out.decode('utf-8').split('\n'): - if line.startswith('Version:'): - version = line.split(' ')[1].strip() - return version + with open("debian/changelog") as f: + line = f.readline() + + m = re.match(".* \\(([0-9.]+)\\) ", line) + if m: + return m.group(1) raise ValueError('Could not parse version from debian/changelog') |