Mercurial > hg > autobot
comparison autobot/config.py @ 304:7b5ffdcd25c0
work on parsing .ini
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 11 May 2014 10:04:54 -0700 |
parents | b854e599bf85 |
children | 9f593b71e2d4 |
comparison
equal
deleted
inserted
replaced
303:84b400e78b64 | 304:7b5ffdcd25c0 |
---|---|
2 | 2 |
3 """ | 3 """ |
4 tools for interpolating buildbot configuration | 4 tools for interpolating buildbot configuration |
5 """ | 5 """ |
6 | 6 |
7 import argparse | |
7 import sys | 8 import sys |
8 from projects import factories | 9 from projects import factories |
9 from ConfigParser import RawConfigParser | 10 from ConfigParser import RawConfigParser |
11 | |
10 | 12 |
11 class BuildbotIniConfig(object): | 13 class BuildbotIniConfig(object): |
12 """ | 14 """ |
13 class for getting a (for now, autobot-specific) | 15 class for getting a (for now, autobot-specific) |
14 buildbot configuration from an .ini file | 16 buildbot configuration from an .ini file |
83 else: | 85 else: |
84 return {} | 86 return {} |
85 | 87 |
86 def main(args=sys.argv[1:]): | 88 def main(args=sys.argv[1:]): |
87 """parse the configuration, mostly for testing purposes""" | 89 """parse the configuration, mostly for testing purposes""" |
88 if len(args) != 1: | 90 |
89 print 'Please provide an .ini file to try to parse' | 91 parser = argparse.ArgumentParser(description="parse autobot .ini configuration") |
90 sys.exit(1) | 92 parser.add_argument('ini', help=".ini file to try to parse") |
91 config = BuildbotIniConfig(args[0]) | 93 config = BuildbotIniConfig(parser.ini) |
92 | 94 |
93 if __name__ == '__main__': | 95 if __name__ == '__main__': |
94 main() | 96 main() |