From: Brandon King Date: Fri, 13 Oct 2006 22:52:24 +0000 (+0000) Subject: Build number python script X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=mussa.git;a=commitdiff_plain;h=ef801c44b13c3092697004be0f683f7185243bf9 Build number python script * Reports the build number of a given darcs repository of mussa. * In support for ticket:124. --- diff --git a/makelib/buildnum.py b/makelib/buildnum.py new file mode 100644 index 0000000..863ce85 --- /dev/null +++ b/makelib/buildnum.py @@ -0,0 +1,20 @@ +#!/usr/bin/python + +import re +import subprocess +import sys + +#_build_search = re.compile('^(Mon)|(Tue)|(Wed)|(Thu)|(Fri)|(Sat)|(Sun)', re.MULTILINE) +_build_search = re.compile('', re.MULTILINE) + +def getBuildNumber(): + """Counts the number of patches that have been made and + returns that as the build number.""" + + p = subprocess.Popen(['darcs', 'changes', '--xml-output'], stdout=subprocess.PIPE) + data = p.stdout.read() + build_num = len(_build_search.findall(data)) + return build_num + +if __name__ == '__main__': + print "%s" % (getBuildNumber())