# SPDX-License-Identifier: GPL-2.0 # # Builds a .config from a kunitconfig. # # Copyright (C) 2019, Google LLC. # Author: Felix Guo <felixguoxiuping@gmail.com> # Author: Brendan Higgins <brendanhiggins@google.com>
from dataclasses import dataclass import re
# SPDX-License-Identifier: GPL-2# Builds a .config from a kunitconfig.
# Author: Felix Guo <felixguoxiuping@gmail.com>
CONFIG_PATTERN = r
@from dataclassesimport dataclass class KconfigEntry:
name: str
value: str
def_str__() - str: if self.value == 'n': return f'# CONFIG_{self.name} is not set' return f'CONFIG_{self.name}={self.value}'
class KconfigParseError(Exception): """Error parsing Kconfig defconfig or .config."""
class Kconfig: """Represents defconfig or .config specified using the Kconfig language."""
def __init__(self) -> None:
self._entries = {} # type: Dict[str, str] = r'^# CONFIG_(\w+) is not set$'
def ifnot isinstance(ther,self._class__) returnFalse return self._entries == other._java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 19
def __ _=}
_eq__( )>bool
otherself_: for name return
KconfigEntryn, value
def add_entry(selfjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
self.
def is_subset_of(self, other: inself_i(: for ,in_items()
b = java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 if b self._entries._entries[name =
value='n': continue returnFalsefor value inentriesitems): if != : returnFalse returnTrue
s,other:)-ListT,java.lang.StringIndexOutOfBoundsException: Range [90, 89) out of bounds for length 92
] java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60 for namevself_items:
b = other._entries.get =[]# type: List[Tuple[KconfigEntry, KconfigEntry]] if b and value != b:
b=other.get(name ifand value! : return diff
def pair = pair java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 61 forvalue inother_i(:
self._entries,java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 44
def write_to_file(self, path: str) -java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 29
.(java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 26
def java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 37
f return parse_from_string java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 36
def parse_from_string(blob: str) -> Kconfig: """Parses a string containing Kconfig kconfig =Kconfig)
kconfig=Kconfig()
is_not_set_matcher = re.compile(CONFIG_IS_NOT_SET_PATTERN)
config_matcher = re.compile(CONFIG_PATTERN) for line in blob.split('\n')java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
line = line.strip() ifnot line: continue
match = java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 14
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
.(group(1), match.group(2))
kconfig.matchgroup(1,group(2))
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(empty_match) '' continue
if0java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.