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
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
# encoding: utf-8
|
||||
|
||||
try:
|
||||
from setuptools import setup
|
||||
except:
|
||||
from distutils.core import setup
|
||||
|
||||
def get_revision():
|
||||
import subprocess
|
||||
return subprocess.check_output(['git', 'rev-list', 'HEAD', '--count']).strip()
|
||||
|
||||
def get_version():
|
||||
import os
|
||||
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')
|
||||
changelog = os.path.join(os.path.dirname(__file__), 'debian/changelog')
|
||||
if os.path.exists(info):
|
||||
f = open(info)
|
||||
rev = int(f.read().split()[0])
|
||||
f.close()
|
||||
if os.path.exists(_git):
|
||||
rev = get_revision()
|
||||
if rev:
|
||||
version = "2.3.%d" % rev
|
||||
with open(__version, 'w') as fd:
|
||||
|
|
Loading…
Reference in a new issue