-def loadModuleData(project):
- module_info_dict = {}
- list_info_dict = {}
- configuration_info_dict = {}
- file_dict = {}
- for filename, path in findDefinitions("*.h", project) + findDefinitions("*.c", project) + findDefinitions("*.s", project) + findDefinitions("*.S", project):
- comment_list = getCommentList(open(path + "/" + filename, "r").read())
- if len(comment_list) > 0:
- module_info = {}
- configuration_info = {}
- try:
- to_be_parsed, module_dict = loadModuleDefinition(comment_list[0])
- except ParseError, err:
- raise DefineException.ModuleDefineException(path, err.line_number, err.line)
- for module, information in module_dict.items():
- if "depends" not in information:
- information["depends"] = ()
- information["depends"] += (filename.split(".")[0],)
- information["category"] = os.path.basename(path)
- if "configuration" in information and len(information["configuration"]):
- configuration = module_dict[module]["configuration"]
- try:
- configuration_info[configuration] = loadConfigurationInfos(project.info("SOURCES_PATH") + "/" + configuration)
- except ParseError, err:
- raise DefineException.ConfigurationDefineException(project.info("SOURCES_PATH") + "/" + configuration, err.line_number, err.line)
- module_info_dict.update(module_dict)
- configuration_info_dict.update(configuration_info)
- if to_be_parsed:
- try:
- list_dict = loadDefineLists(comment_list[1:])
- list_info_dict.update(list_dict)
- except ParseError, err:
- raise DefineException.EnumDefineException(path, err.line_number, err.line)
- for filename, path in findDefinitions("*_" + project.info("CPU_INFOS")["TOOLCHAIN"] + ".h", project):
- comment_list = getCommentList(open(path + "/" + filename, "r").read())
- list_info_dict.update(loadDefineLists(comment_list))
- for tag in project.info("CPU_INFOS")["CPU_TAGS"]:
- for filename, path in findDefinitions("*_" + tag + ".h", project):
- comment_list = getCommentList(open(path + "/" + filename, "r").read())
- list_info_dict.update(loadDefineLists(comment_list))
- project.setInfo("MODULES", module_info_dict)
- project.setInfo("LISTS", list_info_dict)
- project.setInfo("CONFIGURATIONS", configuration_info_dict)
- project.setInfo("FILES", file_dict)
-