mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +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:
parent
085737bbfa
commit
7231030991
@ -1645,8 +1645,14 @@ class KernelConfig(object):
|
|||||||
name, value = line.split('=', 1)
|
name, value = line.split('=', 1)
|
||||||
self._config[name.strip()] = value.strip()
|
self._config[name.strip()] = value.strip()
|
||||||
|
|
||||||
def get(self, name):
|
def get(self, name, strict=False):
|
||||||
return self._config.get(self.get_config_name(name))
|
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):
|
def like(self, name):
|
||||||
regex = re.compile(name, re.I)
|
regex = re.compile(name, re.I)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user