diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2009-09-08 20:40:40 -0400 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2009-09-08 20:40:40 -0400 |
commit | 502888442873ec8f29064cf8ab8490fa3a93b8ed (patch) | |
tree | 2e2a5810ed93d9d428f50823cf9bea6c5d225285 /rpmbuild-remote.py | |
parent | 56222c0a811cfc81895cfaf4ec80b1cd8e7815f8 (diff) | |
download | rpmbuild-remote-502888442873ec8f29064cf8ab8490fa3a93b8ed.tar.gz rpmbuild-remote-502888442873ec8f29064cf8ab8490fa3a93b8ed.tar.xz rpmbuild-remote-502888442873ec8f29064cf8ab8490fa3a93b8ed.zip |
Add a section reader for the config section
Diffstat (limited to 'rpmbuild-remote.py')
-rw-r--r-- | rpmbuild-remote.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/rpmbuild-remote.py b/rpmbuild-remote.py index 6247e03..bd5a90a 100644 --- a/rpmbuild-remote.py +++ b/rpmbuild-remote.py @@ -59,6 +59,26 @@ def get_parser(): "[Default: No mock builds (uses rpmbuild --rebuild otherwise)]") return parser +def read_section(config, section, values): + if not config.has_section(section): + return + ret = {} + for value, typ in values: + if config.has_option(section, value): + if typ == 'int': + method = config.getint + elif typ == 'float': + method = config.getfloat + elif typ == 'boolean': + method = config.getboolean + elif typ == 'str': + method = config.get + else: + method = config.get + LOG.warning("Unknown type %s, assuming string" % typ) + ret[value] = method(section, value) + return ret + def read_preferences(options): system = {} return system |