fix setup
This commit is contained in:
parent
53fbc2e1fb
commit
a1ed41f96d
1 changed files with 9 additions and 1 deletions
10
setup.py
10
setup.py
|
@ -11,6 +11,7 @@ def get_version():
|
||||||
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')
|
||||||
__version = os.path.join(os.path.dirname(__file__), 'ox/__version.py')
|
__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):
|
if os.path.exists(info):
|
||||||
f = open(info)
|
f = open(info)
|
||||||
rev = int(f.read().split()[0])
|
rev = int(f.read().split()[0])
|
||||||
|
@ -23,10 +24,17 @@ def get_version():
|
||||||
elif os.path.exists(__version):
|
elif os.path.exists(__version):
|
||||||
with open(__version) as fd:
|
with open(__version) as fd:
|
||||||
data = fd.read().strip().split('\n')[0]
|
data = fd.read().strip().split('\n')[0]
|
||||||
version = re.compile('VERSION="(.*)"').findal(data)
|
version = re.compile('VERSION="(.*)"').findall(data)
|
||||||
if version:
|
if version:
|
||||||
version = version[0]
|
version = version[0]
|
||||||
return version
|
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'
|
return u'2.1.x'
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
|
|
Loading…
Reference in a new issue