get revision from git; make it work everywhere

This commit is contained in:
Thomas Vander Stichele
2013-07-29 12:36:45 +02:00
parent 430ee02a71
commit 85300a9529
5 changed files with 24 additions and 3 deletions

View File

@@ -23,6 +23,7 @@
import os
import os.path
import commands
import math
import subprocess
@@ -331,3 +332,17 @@ class VersionGetter(object):
raise
return version
def getRevision():
"""
Get a revision tag for the current git source tree.
Appends -modified in case there are local modifications.
"""
describe = commands.getoutput('git describe')
if commands.getoutput('git diff-index --name-only HEAD --'):
describe += '-modified'
return describe