keep version in release

This commit is contained in:
j 2014-10-01 11:03:39 +02:00
parent 6dfa80b646
commit 8bfbaef598
3 changed files with 21 additions and 13 deletions

View file

@ -1,3 +1,4 @@
build build
dist dist
oxutils.egg-info oxutils.egg-info
ox/__version.py

View file

@ -1,7 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4 # vi:si:et:sw=4:sts=4:ts=4
# GPL 2011 # GPL 2011
__version__ = '2.1.1' try:
from . import __version
__version__ = __version.VERSION
except:
__version__ = '2.1.x'
from . import cache from . import cache
from . import js from . import js

View file

@ -6,29 +6,32 @@ try:
except: except:
from distutils.core import setup from distutils.core import setup
def get_bzr_version(): def get_version():
import os import os
import re 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') __version = os.path.join(os.path.dirname(__file__), 'ox/__version.py')
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 version = u"2.1.%s"%rev
elif os.path.exists(changelog): with open(__version, 'w') as fd:
f = open(changelog) fd.write('VERSION="%s"'%version)
head = f.read().strip().split('\n')[0] return version
f.close() elif os.path.exists(__version):
rev = re.compile('\d+\.\d+\.(\d+)').findall(head) with open(__version) as fd:
if rev: data = fd.read().strip().split('\n')[0]
return u"%s" % rev[0] version = re.compile('VERSION="(.*)"').findal(data)
return u'unknown' if version:
version = version[0]
return version
return u'2.1.x'
setup( setup(
name="ox", name="ox",
version="2.1.%s" % get_bzr_version() , version=get_version() ,
description="python-ox - the web in a dict", description="python-ox - the web in a dict",
author="0x2620", author="0x2620",
author_email="0x2620@0x2620.org", author_email="0x2620@0x2620.org",