Split the parameter name and the value of the parameter
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 20 Jan 2009 18:21:16 +0000 (18:21 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 20 Jan 2009 18:21:16 +0000 (18:21 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2189 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/bertos_utils.py

index 593bb4627ca39a42306ffa8ef5a93a8419cbcd49..de2597101a32ee2c71d9b6bdddc2d3951c7f3d96 100644 (file)
@@ -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