]> Pileus Git - ~andy/fetchmail/blob - dist-tools/getstats.py
Merge branch 'legacy_63'
[~andy/fetchmail] / dist-tools / getstats.py
1 #!/usr/bin/env python
2 #
3 # Collect statistics on current release.
4
5 import commands, os, string, ftplib
6
7 # Get version and date
8 date = commands.getoutput("LC_TIME=C date +'%Y-%m-%d'")
9 pid = os.getpid()
10 os.mkdir("/tmp/getstats.%d" % pid)
11
12 cmd = "git archive --format=tar HEAD | ( cd /tmp/getstats.%d && tar -xf -)" % pid
13
14 if os.system(cmd):
15     print "git-archive FAILED"
16     os.exit(1)
17
18 ln = commands.getoutput("cat /tmp/getstats.%d/*.[chly] 2>/dev/null | wc -l" % pid)
19 os.system("rm -rf /tmp/getstats.%d" % pid)
20 vers = commands.getoutput("sed -n -e '/AC_INIT/s/AC_INIT(\\[.\\+\\],\\[\\(.*\\)\\],.*)/\\1/p' <configure.ac")
21 print "fetchmail-" + vers + " (released " + date + ", " + string.strip(ln) + " LoC):"
22
23 # end of getstats.py