Add a function for retrieve the modules configurations parameters
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 19 Jan 2009 18:23:22 +0000 (18:23 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 19 Jan 2009 18:23:22 +0000 (18:23 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2182 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/bertos_utils.py

index 428e11e6a3ad125f69c8ee71eb6364c482ef4554..2e55ffaaad465d216d871e08e5410fea38c3bd90 100644 (file)
@@ -101,3 +101,12 @@ def getDefinitionBlocks(text):
         block.append((" ".join(re.findall(r"^\s*\*?\s*(.*?)\s*?$", comment, re.MULTILINE)), define))
     block += re.findall(r"/{3}<?\s*(.*)\s*#define\s+(.*)\s*?$", text, re.MULTILINE)
     return block
+
+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)
+    return moduleInfos
\ No newline at end of file