annotate commitwatcher/main.py @ 1:4e24f3c6610c

agent
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 26 Sep 2013 05:11:57 -0700
parents bdc039cb1f2e
children 4cb3971d9d9d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 #!/usr/bin/env python
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 """
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5 new service to monitor mozbase commits
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6 """
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8 import optparse
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9 import os
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10 import subprocess
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11 import sys
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
12
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13 def add_options(parser):
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14 """add options to the OptionParser instance"""
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
16 def main(args=sys.argv[1:]):
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
18 # parse command line options
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
19 usage = '%prog [options] ...'
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
20 class PlainDescriptionFormatter(optparse.IndentedHelpFormatter):
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
21 """description formatter for console script entry point"""
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
22 def format_description(self, description):
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
23 if description:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
24 return description.strip() + '\n'
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
25 else:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
26 return ''
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
27 parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter())
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
28 options, args = parser.parse_args(args)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
29
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
30 if __name__ == '__main__':
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
31 main()
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
32