summaryrefslogtreecommitdiffstats
blob: c707942bf7ff0ba0942827e67fc528f6530a9341 (plain)
1
2
3
4
5
6
7
8
9
10
import subprocess

def getGitBuildVersion() :
  p = subprocess.Popen("git rev-parse HEAD", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)
  return p.stdout.read().rstrip()[0:7]

def getBuildVersion(version = None) :
  if version :
    return version
  return getGitBuildVersion()