From de2c05363918e67440d53c5b3a60664b26cd1afb Mon Sep 17 00:00:00 2001 From: duplo Date: Fri, 20 Mar 2009 11:26:42 +0000 Subject: [PATCH] Use a separate dict for identify the module tags git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2394 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/bertos_utils.py | 18 +++++++++--------- wizard/const.py | 8 +++++++- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index 92d85fdf..3e8f36ba 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -240,20 +240,20 @@ def loadModuleDefinition(first_comment): moduleDefinition["module_description"] = line[line.find("\\brief") + len("\\brief "):] moduleDict = {} if "module_name" in moduleDefinition.keys(): - moduleDict[moduleDefinition["module_name"]] = {} + moduleDict[moduleDefinition[const.MODULE_DEFINITION["module_name"]]] = {} if "module_depends" in moduleDefinition.keys(): - if type(moduleDefinition["module_depends"]) == str: - moduleDefinition["module_depends"] = (moduleDefinition["module_depends"],) - moduleDict[moduleDefinition["module_name"]]["depends"] = moduleDefinition["module_depends"] + if type(moduleDefinition[const.MODULE_DEFINITION["module_depends"]]) == str: + moduleDefinition[const.MODULE_DEFINITION["module_depends"]] = (moduleDefinition[const.MODULE_DEFINITION["module_depends"]],) + moduleDict[moduleDefinition[const.MODULE_DEFINITION["module_name"]]]["depends"] = moduleDefinition[const.MODULE_DEFINITION["module_depends"]] else: - moduleDict[moduleDefinition["module_name"]]["depends"] = () + moduleDict[moduleDefinition[const.MODULE_DEFINITION["module_name"]]]["depends"] = () if "module_configuration" in moduleDefinition.keys(): - moduleDict[moduleDefinition["module_name"]]["configuration"] = moduleDefinition["module_configuration"] + moduleDict[moduleDefinition[const.MODULE_DEFINITION["module_name"]]]["configuration"] = moduleDefinition[const.MODULE_DEFINITION["module_configuration"]] else: - moduleDict[moduleDefinition["module_name"]]["configuration"] = "" + moduleDict[moduleDefinition[const.MODULE_DEFINITION["module_name"]]]["configuration"] = "" if "module_description" in moduleDefinition.keys(): - moduleDict[moduleDefinition["module_name"]]["description"] = moduleDefinition["module_description"] - moduleDict[moduleDefinition["module_name"]]["enabled"] = False + moduleDict[moduleDefinition[const.MODULE_DEFINITION["module_name"]]]["description"] = moduleDefinition["module_description"] + moduleDict[moduleDefinition[const.MODULE_DEFINITION["module_name"]]]["enabled"] = False return toBeParsed, moduleDict def loadDefineLists(commentList): diff --git a/wizard/const.py b/wizard/const.py index 79d72ef8..2b894126 100644 --- a/wizard/const.py +++ b/wizard/const.py @@ -47,4 +47,10 @@ EXTENSION_FILTER = ( ".c++", ".mk", "Makefile", -) \ No newline at end of file +) + +MODULE_DEFINITION = { + "module_name": "module_name", + "module_configuration": "module_configuration", + "module_depends": "module_depends", +} \ No newline at end of file -- 2.25.1