aboutsummaryrefslogtreecommitdiffhomepage
path: root/setup.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2021-04-28 09:03:28 +0200
committerGuido Günther <agx@sigxcpu.org>2021-04-28 09:15:31 +0200
commit35d91d5f1dbdeadb49aca1d91184b45aeb43a1b8 (patch)
tree740987e3b34d027d4907ec9faa7b2d3212e4990b /setup.py
parent3f8a58c1f48bed0492295e37ddb2318125d9e39c (diff)
setup.py: Avoid dpkg-parsechangelog
This helps on non-debian systems
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/setup.py b/setup.py
index fc99c5a9..962bf14c 100755
--- a/setup.py
+++ b/setup.py
@@ -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')