changeset 12:a4aa9f83e3be

adding a thing for commands
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 10 Jul 2012 17:01:05 -0700
parents b7b59561be5e
children 323a01abd180
files talosnames/api.py talosnames/main.py
diffstat 2 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/talosnames/api.py	Tue Jul 10 16:26:57 2012 -0700
+++ b/talosnames/api.py	Tue Jul 10 17:01:05 2012 -0700
@@ -1,8 +1,12 @@
+import os
 import re
 import require
 import sqlite3
+import sys
 import urllib2
 
+sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
+
 class TalosNames(object):
     graphserver_sql = 'http://hg.mozilla.org/graphs/raw-file/tip/sql/data.sql'
     schema = 'http://hg.mozilla.org/graphs/raw-file/tip/sql/schema.sql'
@@ -71,6 +75,9 @@
 #        project_branches = require.require(self.project_branches)
         module = require.require(self.buildbot_config)
         self.suites = module.SUITES
+        self.buildbot_commands = {}
+        for key, value in self.suites.items():
+            self.buildbot_commands[key] = value['suites']
 
     ### functions for fetching information
 
@@ -81,6 +88,10 @@
             if regex.match(name):
                 return tbplname
 
+    def buildbot_command(self, name):
+        """gets the buildbot command for a particular suite"""
+        return self.buildbot_commands.get(name)
+
     def __call__(self, name=None):
         retval = []
         for short_name, graphserver_name in self.names.items():
--- a/talosnames/main.py	Tue Jul 10 16:26:57 2012 -0700
+++ b/talosnames/main.py	Tue Jul 10 17:01:05 2012 -0700
@@ -27,6 +27,17 @@
         """give TBPL name given the buildbot config name"""
         return self.api.tbpl_name(name)
 
+    def suites(self):
+        """list the buildbot suites"""
+        suites = sorted(self.api.suites.keys())
+        return suites
+
+    def command(self, suite):
+        """returns the command that buildbot runs for a particular suite"""
+
+    def tests(self):
+        pass
+
 def main(args=sys.argv[1:]):
     parser = CommandParser(TalosNamesCLI)
     parser.invoke(sys.argv[1:])