+def formatParamNameValue(text):
+ """
+ Take the given string and return a tuple with the name of the parameter in the first position
+ and the value in the second.
+ """
+ block = re.findall("\s*([^\s]+)\s*(.+?)\s*$", text, re.MULTILINE)
+ return block[0]
+
+def getDescriptionInformations(text):
+ """
+ Take the doxygen comment and strip the wizard informations, returning the tuple
+ (comment, wizard_informations)
+ """
+ index = text.find("$WIZARD")
+ if index != -1:
+ exec(text[index + 1:])
+ informations = WIZARD
+ return text[:index].strip(), informations
+ else:
+ return text.strip(), {}
+
+def loadConfigurationInfos(path):
+ """
+ Return the module configurations found in the given file as a dict with the
+ parameter name as key and a dict containig the fields above as value:
+ "value": the value of the parameter
+ "description": the description of the parameter
+ "informations": a dict containig optional informations:
+ "type": "int" | "boolean" | "enum"
+ "min": the minimum value for integer parameters
+ "max": the maximum value for integer parameters
+ "long": boolean indicating if the num is a long
+ "value_list": the name of the enum for enum parameters
+ """
+ configurationInfos = {}
+ for comment, define in getDefinitionBlocks(open(path, "r").read()):
+ name, value = formatParamNameValue(define)
+ description, informations = getDescriptionInformations(comment)
+ configurationInfos[name] = {}
+ configurationInfos[name]["value"] = value
+ configurationInfos[name]["informations"] = informations
+ configurationInfos[name]["description"] = description
+ return configurationInfos
+