diff options
Diffstat (limited to 'py/config/tool.py')
-rwxr-xr-x | py/config/tool.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/py/config/tool.py b/py/config/tool.py new file mode 100755 index 0000000000..6afa5e8526 --- /dev/null +++ b/py/config/tool.py @@ -0,0 +1,17 @@ +import inspect + + +# Collect a list of options from a module. +# XXX: check to make sure only options are fed to this. +def get_option_class(module): + map = {} + skip = ("Option", "Boolean", "String", "StringList", "Integer") + for name, obj in inspect.getmembers(module): + if inspect.isclass(obj) and name not in skip: + if name in map: + raise Exception("Duplicate option: %s" % name) + map[name] = obj + + return map + + |