changeset 46:fcd98303a90d

provide CLI handler for web
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 13 Aug 2012 15:14:53 -0700
parents c1cbb79a6aaf
children 11249e75ced6
files setup.py talosnames/web.py
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Mon Aug 13 00:01:02 2012 -0700
+++ b/setup.py	Mon Aug 13 15:14:53 2012 -0700
@@ -14,6 +14,7 @@
     kw['entry_points'] = """
       [console_scripts]
       talos-names = talosnames.main:main
+      talos-names-web = talosnames.web:main
 """
     kw['install_requires'] = dependencies
     kw['dependency_links'] = ['http://hg.mozilla.org/build/talos/archive/tip.tar.gz#egg=talos']
--- a/talosnames/web.py	Mon Aug 13 00:01:02 2012 -0700
+++ b/talosnames/web.py	Mon Aug 13 15:14:53 2012 -0700
@@ -7,6 +7,7 @@
 import optparse
 import os
 import pprint
+import sys
 import talos.test
 import tempita
 from api import TalosNames
@@ -38,7 +39,6 @@
                      'tbpl': dict([(suite, self.api.tbpl_name(suite))
                                    for suite in suites]),
                      'tests': tests,
-                     'pprint': pprint.pformat,
                      'list2cmdline': list2cmdline
                      }
 
@@ -125,8 +125,7 @@
         _template = tempita.HTMLTemplate(contents)
         return _template.substitute(data)
 
-if __name__ == '__main__':
-
+def main(args=sys.argv[1:]):
     parser = optparse.OptionParser()
     parser.add_option('-o', '--output', dest='output',
                       help="file to output to")
@@ -136,6 +135,7 @@
     options, args = parser.parse_args()
 
     app = Handler()
+    print "Done creating handler."
 
     if options.output:
         f = file(options.output, 'w')
@@ -147,3 +147,8 @@
         server.serve_forever()
 
 
+if __name__ == '__main__':
+    main()
+
+
+