use git to get revision for __version__

This commit is contained in:
shimizukawa 2015-02-25 00:17:41 +09:00
parent 77b76439cc
commit f5a31a759b

View File

@ -30,12 +30,12 @@ if '+' in __version__ or 'pre' in __version__:
# automatically propagated to an installed copy as well) # automatically propagated to an installed copy as well)
try: try:
import subprocess import subprocess
p = subprocess.Popen(['hg', 'id', '-i', '-R', p = subprocess.Popen(['git', 'show', '-s', '--pretty=format:%h',
path.join(package_dir, '..')], path.join(package_dir, '..')],
stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate() out, err = p.communicate()
if out: if out:
__version__ += '/' + out.strip() __version__ += '/' + out.decode().strip()
except Exception: except Exception:
pass pass