fix setup

This commit is contained in:
j 2014-10-02 08:34:42 +02:00
parent 53fbc2e1fb
commit a1ed41f96d

View file

@ -11,6 +11,7 @@ def get_version():
import re
info = os.path.join(os.path.dirname(__file__), '.bzr/branch/last-revision')
__version = os.path.join(os.path.dirname(__file__), 'ox/__version.py')
changelog = os.path.join(os.path.dirname(__file__), 'debian/changelog')
if os.path.exists(info):
f = open(info)
rev = int(f.read().split()[0])
@ -23,10 +24,17 @@ def get_version():
elif os.path.exists(__version):
with open(__version) as fd:
data = fd.read().strip().split('\n')[0]
version = re.compile('VERSION="(.*)"').findal(data)
version = re.compile('VERSION="(.*)"').findall(data)
if version:
version = version[0]
return version
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'2.1.%s'%rev[0]
return u'2.1.x'
setup(