From ef801c44b13c3092697004be0f683f7185243bf9 Mon Sep 17 00:00:00 2001 From: Brandon King Date: Fri, 13 Oct 2006 22:52:24 +0000 Subject: [PATCH] Build number python script * Reports the build number of a given darcs repository of mussa. * In support for ticket:124. --- makelib/buildnum.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 makelib/buildnum.py 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()) -- 2.30.2