From 037b67471bcac6a27fb69f1df8288b96af8b7093 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 24 Apr 2013 15:52:49 +0200 Subject: [PATCH] use debian version if available --- setup.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/setup.py b/setup.py index 79c2963..a3c47c1 100644 --- a/setup.py +++ b/setup.py @@ -8,13 +8,22 @@ except: def get_bzr_version(): import os + import re info = os.path.join(os.path.dirname(__file__), '.bzr/branch/last-revision') + changelog = os.path.join(os.path.dirname(__file__), 'debian/changelog') if os.path.exists(info): f = open(info) rev = int(f.read().split()[0]) f.close() if rev: return u'%s' % rev + elif os.path.exists(changelog): + f = open(changelog) + head = f.read().strip().split('\n')[0] + f.close() + rev = re.compile('\d+\.\d+\.(\d+)').findall(head) + if rev: + return u"%s" % rev[0] return u'unknown' setup(