# HG changeset patch # User Jeff Hammel # Date 1399826900 25200 # Node ID aec0a7f8c191aba618f8e72ff6978faab6b8d51d # Parent aeaf4494c7d85ccd457ae48a8aa24792115d9b16 STUB: autobot/template/restart_buildbot.py diff -r aeaf4494c7d8 -r aec0a7f8c191 autobot/template/restart_buildbot.py --- a/autobot/template/restart_buildbot.py Sun May 11 09:45:14 2014 -0700 +++ b/autobot/template/restart_buildbot.py Sun May 11 09:48:20 2014 -0700 @@ -2,26 +2,26 @@ """(re)start the buildbot""" -import optparse +import argparse import os import sys from subprocess import call -from time import sleep here = os.path.abspath(os.path.dirname(sys.argv[0])) debug = {{debug}} + def main(args=sys.argv[1:]): + """CLI""" # parse command line options - usage = '%prog [options]' - parser = optparse.OptionParser(usage=usage, description=__doc__) - parser.add_option('--stop', dest='stop', + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--stop', dest='stop', action='store_true', default=False, - help="stop the buildbot only") - # could force a build here - # buildbot sendchange ... - options, args = parser.parse_args(args) + help="stop the buildbot only; don't restart") + # TODO: could force a build here: + # buildbot sendchange ... + options = parser.parse_args(args) # cleanup if debug: