add git commit hash to version string

This commit is contained in:
Frédéric Péters 2013-04-26 09:46:11 +02:00
parent 13e9905351
commit 65240fb024
2 changed files with 15 additions and 2 deletions

View File

@ -1,7 +1,10 @@
#! /usr/bin/env python
import os
from distutils.core import setup
from datetime import datetime
import os
import subprocess
from quixote.ptl.qx_distutils import qx_build_py
local_cfg = None
@ -20,9 +23,18 @@ def data_tree(destdir, sourcedir):
dirs.remove(vcs_dirname)
return r
def get_version():
from wcs import __version__ as version
if os.path.exists('.git'):
p = subprocess.Popen(['git','log','--oneline','HEAD~..'],
stdout=subprocess.PIPE)
result = p.communicate()[0]
version += '+%s.%s' % (datetime.today().strftime('%Y%m%d'), result.split()[0])
return version
setup(
name = 'wcs',
version = '1.9',
version=get_version(),
maintainer = "Frederic Peters",
maintainer_email = "fpeters@entrouvert.com",
url = "http://wcs.labs.libre-entreprise.org",

View File

@ -18,6 +18,7 @@ import sys
import os
sys.path.insert(0, os.path.dirname(__file__))
__version__ = '1.9'
import qommon