changeset 3:7495c25d8476

WIP
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 03 Dec 2012 21:49:55 -0800
parents 3eaee0d10880
children 14275dcbff10
files mozillatry.py
diffstat 1 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mozillatry.py	Sat Dec 01 23:05:19 2012 -0800
+++ b/mozillatry.py	Mon Dec 03 21:49:55 2012 -0800
@@ -76,7 +76,8 @@
                       help='no debug builds')
     parser.add_option('-u', dest='unittests', action='append',
                       help='unittests')
-    parser.add_option('-t', dest='talos', action='append',
+    parser.add_option('-t', dest='talostests',
+                      action='append',
                       help='talos tests')
     parser.add_option('--bug', dest='bug', type='int',
                       help='post to bugzilla bug #')
@@ -94,15 +95,27 @@
     # e.g. http://k0s.org/mozilla/hg/configuration/
     from ConfigParser import ConfigParser
     parser = ConfigParser()
+    if not os.path.exists(filename):
+        return parser
     parser.read(filename)
     if options.mozilla_central is None:
         try:
             path = parser.get('hg', 'mozilla-central')
-            os.path.expanduser(path)
+            if path:
+                options.mozilla_central = os.path.expanduser(path)
         except Exception: # XXX temporary hack
             pass
     return parser
 
+def check(parser, options, args):
+    """check configuration"""
+
+    if not args:
+        parser.print_help()
+        parser.exit()
+    if (not options.opt) and (not options.debug):
+        parser.error("Must enable opt or debug builds")
+
 
 def main(args=sys.argv[1:]):
 
@@ -119,19 +132,14 @@
     parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter())
     add_options(parser)
     options, args = parser.parse_args(args)
-    if not args:
-        parser.print_help()
-        parser.exit()
-    if (not options.opt) and (not options.debug):
-        parser.error("Must enable opt or debug builds")
+    config_file = options.config
+    read_config(config_file)
 
     # get mozilla-central repository directory
-    config_file = options.__dict__.pop('config')
     if os.path.exists(config_file):
-        read_config(config_file)
     try_directory = options.mozilla_central
     if (try_directory is None) or (not os.path.exists(try_directory)):
-        parser.error("mozilla-central try directory does not exist: %s" % try_directory)
+        parser.error("mozilla-central directory does not exist: %s" % try_directory)
 
     # build try syntax
     commit = try_syntax(**options.__dict__)