use debian version if available
This commit is contained in:
parent
7e4c2bdaff
commit
037b67471b
1 changed files with 9 additions and 0 deletions
9
setup.py
9
setup.py
|
@ -8,13 +8,22 @@ except:
|
||||||
|
|
||||||
def get_bzr_version():
|
def get_bzr_version():
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
info = os.path.join(os.path.dirname(__file__), '.bzr/branch/last-revision')
|
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):
|
if os.path.exists(info):
|
||||||
f = open(info)
|
f = open(info)
|
||||||
rev = int(f.read().split()[0])
|
rev = int(f.read().split()[0])
|
||||||
f.close()
|
f.close()
|
||||||
if rev:
|
if rev:
|
||||||
return u'%s' % 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'
|
return u'unknown'
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
|
|
Loading…
Reference in a new issue