diff --git a/setup.py b/setup.py index 45460eb..6dc9066 100644 --- a/setup.py +++ b/setup.py @@ -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(