- for definition in findDefinitions(const.MODULE_CONFIGURATION, path):
- moduleName = definition[0].replace("cfg_", "").replace(".h", "")
- moduleInfos[moduleName] = {}
- for comment, define in getDefinitionBlocks(open(definition[1] + "/" + definition[0], "r").read()):
- name, value = formatModuleNameValue(define)
- description, informations = getDescriptionInformations(comment)
- moduleInfos[moduleName][name] = {}
- moduleInfos[moduleName][name]["value"] = value
- moduleInfos[moduleName][name]["description"] = description
- moduleInfos[moduleName][name]["informations"] = informations
- return moduleInfos
+ string = open(path, "r").read()
+ commentList = re.findall(r"/\*{2}\s*([^*]*\*(?:[^/*][^*]*\*+)*)/", string)
+ commentList = [" ".join(re.findall(r"^\s*\*?\s*(.*?)\s*?(?:/{2}.*?)?$", comment, re.MULTILINE)).strip() for comment in commentList]
+ for comment in commentList:
+ index = comment.find("$WIZARD_MODULE")
+ if index != -1:
+ exec(comment[index + 1:])
+ moduleInfos[WIZARD_MODULE["name"]] = {"depends": WIZARD_MODULE["depends"], "configuration": WIZARD_MODULE["configuration"]}
+ return moduleInfos
+ return {}
+
+def loadDefineLists(path):
+ """
+ Return a dict with the name of the list as key and a list of string as value
+ """
+ string = open(path, "r").read()
+ commentList = re.findall(r"/\*{2}\s*([^*]*\*(?:[^/*][^*]*\*+)*)/", string)
+ commentList = [" ".join(re.findall(r"^\s*\*?\s*(.*?)\s*?(?:/{2}.*?)?$", comment, re.MULTILINE)).strip() for comment in commentList]
+ listDict = {}
+ for comment in commentList:
+ index = comment.find("$WIZARD_LIST")
+ if index != -1:
+ exec(comment[index + 1:])
+ listDict.update(WIZARD_LIST)
+ return listDict
\ No newline at end of file