mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
target: Move kernel config parsing in method
Split kernel config parsing from target.KernelConfig from __init__ into its separate method
This commit is contained in:
parent
7e79eeb9cb
commit
781f9b068d
@ -1779,16 +1779,21 @@ class KernelConfig(object):
|
||||
|
||||
def __init__(self, text):
|
||||
self.text = text
|
||||
self._config = {}
|
||||
self._config = self._parse_text(text)
|
||||
|
||||
@classmethod
|
||||
def _parse_text(cls, text):
|
||||
config = {}
|
||||
for line in text.split('\n'):
|
||||
line = line.strip()
|
||||
if line.startswith('#'):
|
||||
match = self.not_set_regex.search(line)
|
||||
match = cls.not_set_regex.search(line)
|
||||
if match:
|
||||
self._config[match.group(1)] = 'n'
|
||||
config[match.group(1)] = 'n'
|
||||
elif '=' in line:
|
||||
name, value = line.split('=', 1)
|
||||
self._config[name.strip()] = value.strip()
|
||||
config[name.strip()] = value.strip()
|
||||
return config
|
||||
|
||||
def get(self, name, strict=False):
|
||||
name = self.get_config_name(name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user