get version from git
This commit is contained in:
parent
98d83192ce
commit
c5f5262a96
2 changed files with 8 additions and 9 deletions
|
@ -1,4 +0,0 @@
|
||||||
build
|
|
||||||
dist
|
|
||||||
oxutils.egg-info
|
|
||||||
ox/__version.py
|
|
13
setup.py
13
setup.py
|
@ -1,21 +1,24 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
except:
|
except:
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
|
|
||||||
|
def get_revision():
|
||||||
|
import subprocess
|
||||||
|
return subprocess.check_output(['git', 'rev-list', 'HEAD', '--count']).strip()
|
||||||
|
|
||||||
def get_version():
|
def get_version():
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
info = os.path.join(os.path.dirname(__file__), '.bzr/branch/last-revision')
|
_git = os.path.join(os.path.dirname(__file__), '.git')
|
||||||
__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')
|
changelog = os.path.join(os.path.dirname(__file__), 'debian/changelog')
|
||||||
if os.path.exists(info):
|
if os.path.exists(_git):
|
||||||
f = open(info)
|
rev = get_revision()
|
||||||
rev = int(f.read().split()[0])
|
|
||||||
f.close()
|
|
||||||
if rev:
|
if rev:
|
||||||
version = "2.3.%d" % rev
|
version = "2.3.%d" % rev
|
||||||
with open(__version, 'w') as fd:
|
with open(__version, 'w') as fd:
|
||||||
|
|
Loading…
Reference in a new issue