From: duplo Date: Tue, 20 Jan 2009 18:21:16 +0000 (+0000) Subject: Split the parameter name and the value of the parameter X-Git-Tag: 2.1.0~493 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;ds=inline;h=9efa7a70c29cd4e8cd2f114c6aae748f82d8d5ef;p=bertos.git Split the parameter name and the value of the parameter git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2189 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index 593bb462..de259710 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -103,11 +103,16 @@ def getDefinitionBlocks(text): block += [(comment, define) for define, comment in re.findall(r"#define\s*(.*?)\s*/{3}<\s*(.+?)\s*?(?:/{2,3}[^<].*?)?$", text, re.MULTILINE)] return block +def formatModuleNameValue(text): + block = re.findall("\s*([^\s]+)\s*(.+?)\s*$", text, re.MULTILINE) + return block[0] + def loadModuleInfos(path): moduleInfos = {} for definition in findDefinitions(const.MODULE_CONFIGURATION, path): moduleName = definition[0].replace("cfg_", "").replace(".h", "") moduleInfos[moduleName] = [] - for element in getDefinitionBlocks(open(definition[1] + "/" + definition[0], "r").read()): - moduleInfos[moduleName].append(element) + for description, define in getDefinitionBlocks(open(definition[1] + "/" + definition[0], "r").read()): + name, value = formatModuleNameValue(define) + moduleInfos[moduleName].append((name, value, description)) return moduleInfos