summaryrefslogtreecommitdiff
path: root/py/config/tool.py
blob: 6afa5e852680d53182f4ffbc29308e5e51bd6059 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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