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
dist
oxutils.egg-info
ox/__version.py

View file

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

View file

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