1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 10:10:46 +00:00

target: Add strict option to KernelConfig.get()

Defaults to False. If True, will raise an exception when a requested
config name is not exposed in the config instance.
This commit is contained in:
Valentin Schneider 2018-06-08 18:15:10 +01:00 committed by setrofim
parent 085737bbfa
commit 7231030991

View File

@ -1645,8 +1645,14 @@ class KernelConfig(object):
name, value = line.split('=', 1)
self._config[name.strip()] = value.strip()
def get(self, name):
return self._config.get(self.get_config_name(name))
def get(self, name, strict=False):
name = self.get_config_name(name)
res = self._config.get(name)
if not res and strict:
raise IndexError("{} is not exposed in target's config")
return self._config.get(name)
def like(self, name):
regex = re.compile(name, re.I)