changeset 304:7b5ffdcd25c0

work on parsing .ini
author Jeff Hammel <k0scist@gmail.com>
date Sun, 11 May 2014 10:04:54 -0700
parents 84b400e78b64
children 52baa0f2995a
files autobot/config.py setup.py
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/autobot/config.py	Sun May 11 09:59:34 2014 -0700
+++ b/autobot/config.py	Sun May 11 10:04:54 2014 -0700
@@ -4,10 +4,12 @@
 tools for interpolating buildbot configuration
 """
 
+import argparse
 import sys
 from projects import factories
 from ConfigParser import RawConfigParser
 
+
 class BuildbotIniConfig(object):
     """
     class for getting a (for now, autobot-specific)
@@ -85,10 +87,10 @@
 
 def main(args=sys.argv[1:]):
     """parse the configuration, mostly for testing purposes"""
-    if len(args) != 1:
-        print 'Please provide an .ini file to try to parse'
-        sys.exit(1)
-    config = BuildbotIniConfig(args[0])
+
+    parser = argparse.ArgumentParser(description="parse autobot .ini configuration")
+    parser.add_argument('ini', help=".ini file to try to parse")
+    config = BuildbotIniConfig(parser.ini)
 
 if __name__ == '__main__':
     main()
--- a/setup.py	Sun May 11 09:59:34 2014 -0700
+++ b/setup.py	Sun May 11 10:04:54 2014 -0700
@@ -34,5 +34,6 @@
       create-autobot-master = autobot.template:create_master
       create-autobot-slave = autobot.template:create_slave
       create-autobot-project = autobot.template:create_project
+      parse-autobot-config = autobot.config:main
       """,
       )