summaryrefslogtreecommitdiff
path: root/py/config/__init__.py
blob: fa1ea35fdf5956624ee6cde6818501388f5e6552 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from .base import BuildConfig, Config, Default, Feature, Disable
from .options import Option, Boolean, String, StringList, Integer
from .tag import tag_map

class RTEMSConfig(object):
	"""
		Main entry point for RTEMS Config

		:param dict default: Default options.
		:param list config: Default configs.

	"""

	def __init__(self, default, config):
		self.default = default	# Dictionary of options.
		self.config = config	# List of configs.
#		self.config = feature	# List of features.

	def options_get(self, category=False):
		"""
			Return sorted list of options

			:param list category: Categories

			:returns: List of options optionally limited by categories.
			:rtype: list
		"""

		if category:
			tmp = {}
			for name, option in self.default.items():
				if not set(category).isdisjoint(option.tag):
					tmp[name] = option
			return [v for (k, v) in sorted(tmp.items())]

		return [v for (k, v) in sorted(self.default.items())]