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):
|
def __init__(self, text):
|
||||||
self.text = 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'):
|
for line in text.split('\n'):
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if line.startswith('#'):
|
if line.startswith('#'):
|
||||||
match = self.not_set_regex.search(line)
|
match = cls.not_set_regex.search(line)
|
||||||
if match:
|
if match:
|
||||||
self._config[match.group(1)] = 'n'
|
config[match.group(1)] = 'n'
|
||||||
elif '=' in line:
|
elif '=' in line:
|
||||||
name, value = line.split('=', 1)
|
name, value = line.split('=', 1)
|
||||||
self._config[name.strip()] = value.strip()
|
config[name.strip()] = value.strip()
|
||||||
|
return config
|
||||||
|
|
||||||
def get(self, name, strict=False):
|
def get(self, name, strict=False):
|
||||||
name = self.get_config_name(name)
|
name = self.get_config_name(name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user