try:
bertos_utils.loadModuleData(self._project())
except ModuleDefineException, e:
- self._exceptionOccurred(self.tr("Error parsing module information in file %1").arg(e.path))
+ self._exceptionOccurred(self.tr("Error parsing line '%2' in file %1").arg(e.path).arg(e.line))
except EnumDefineException, e:
- self._exceptionOccurred(self.tr("Error parsing enum informations in file %1").arg(e.path))
+ self._exceptionOccurred(self.tr("Error parsing line '%2' in file %1").arg(e.path).arg(e.line))
except ConfigurationDefineException, e:
- self._exceptionOccurred(self.tr("Error parsing configuration informations in file %1, reading parameter %2").arg(e.path).arg(e.name))
+ self._exceptionOccurred(self.tr("Error parsing line '%2' in file %1").arg(e.path).arg(e.line))
def _fillModuleTable(self):
modules = self._projectInfoRetrieve("MODULES")
self._resetPropertyDescription()
configurations = self._currentModuleConfigurations()
if self._currentProperty() in configurations.keys():
- description = configurations[self._currentProperty()]["description"]
+ description = configurations[self._currentProperty()]["brief"]
name = self._currentProperty()
self._currentPropertyItem().setText(name + "\n" + description)
"""
Exception raised when an error occurs parsing the module informations.
"""
- def __init__(self, path):
+ def __init__(self, path, line_number, line):
self.path = path
+ self.line_number = line_number
+ self.line = line
def __str__(self):
return repr(self.path)
"""
Exception raised when an error occurs parsing the module informations.
"""
- def __init__(self, path):
- super(ModuleDefineException, self).__init__(path)
+ def __init__(self, path, line_number, line):
+ super(ModuleDefineException, self).__init__(path, line_number, line)
class EnumDefineException(DefineException):
"""
Exception raised when an error occurs parsing the enum informations.
"""
- def __init__(self, path):
- super(EnumDefineException, self).__init__(path)
+ def __init__(self, path, line_number, line):
+ super(EnumDefineException, self).__init__(path, line_number, line)
class ConfigurationDefineException(DefineException):
"""
Exception raised when an error occurs parsing the configuration parameter informations.
"""
- def __init__(self, path, name):
- super(ConfigurationDefineException, self).__init__(path)
- self.name = name
+ def __init__(self, path, line_number, line):
+ super(ConfigurationDefineException, self).__init__(path, line_number, line)
try:
toBeParsed, moduleDict = loadModuleDefinition(commentList[0])
except ParseError, err:
- print "error in file %s. line: %d - statement %s" % (path + "/" + filename, err.line_number, err.line)
- print err.args
- print err.message
- raise Exception
+ raise DefineException.ModuleDefineException(path, err.line_number, err.line)
for module, information in moduleDict.items():
if "configuration" in information.keys() and len(information["configuration"]):
configuration = moduleDict[module]["configuration"]
- configurationInfo[configuration] = loadConfigurationInfos(project.info("SOURCES_PATH") + "/" + configuration)
+ try:
+ configurationInfo[configuration] = loadConfigurationInfos(project.info("SOURCES_PATH") + "/" + configuration)
+ except ParseError, err:
+ raise DefineException.ConfigurationDefineException(project.info("SOURCES_PATH") + "/" + configuration, err.line_number, err.line)
moduleInfoDict.update(moduleDict)
configurationInfoDict.update(configurationInfo)
if toBeParsed:
listDict = loadDefineLists(commentList[1:])
listInfoDict.update(listDict)
except ParseError, err:
- print "error in file %s. line: %d - statement %s" % (path + "/" + filename, err.line_number, err.line)
- print err.args
- print err.message
- raise Exception
+ raise DefineException.EnumDefineException(path, err.line_number, err.line)
for filename, path in findDefinitions("*_" + project.info("CPU_INFOS")["TOOLCHAIN"] + ".h", project):
commentList = getCommentList(open(path + "/" + filename, "r").read())
listInfoDict.update(loadDefineLists(commentList))
"long": boolean indicating if the num is a long
"value_list": the name of the enum for enum parameters
"""
- try:
- configurationInfos = {}
- for comment, define in getDefinitionBlocks(open(path, "r").read()):
- name, value = formatParamNameValue(define)
- brief, description, informations = getDescriptionInformations(comment)
- configurationInfos[name] = {}
- configurationInfos[name]["value"] = value
- configurationInfos[name]["informations"] = informations
- if ("type" in configurationInfos[name]["informations"].keys() and
- configurationInfos[name]["informations"]["type"] == "int" and
- configurationInfos[name]["value"].find("L") != -1):
- configurationInfos[name]["informations"]["long"] = True
- configurationInfos[name]["value"] = configurationInfos[name]["value"].replace("L", "")
- if ("type" in configurationInfos[name]["informations"].keys() and
- configurationInfos[name]["informations"]["type"] == "int" and
- configurationInfos[name]["value"].find("U") != -1):
- configurationInfos[name]["informations"]["unsigned"] = True
- configurationInfos[name]["value"] = configurationInfos[name]["value"].replace("U", "")
- configurationInfos[name]["description"] = description
- configurationInfos[name]["brief"] = brief
- return configurationInfos
- except ParseError, err:
- print "error in file %s. line: %d - statement %s" % (path, err.line_number, err.line)
- print err.args
- print err.message
- raise Exception
+ configurationInfos = {}
+ for comment, define in getDefinitionBlocks(open(path, "r").read()):
+ name, value = formatParamNameValue(define)
+ brief, description, informations = getDescriptionInformations(comment)
+ configurationInfos[name] = {}
+ configurationInfos[name]["value"] = value
+ configurationInfos[name]["informations"] = informations
+ if ("type" in configurationInfos[name]["informations"].keys() and
+ configurationInfos[name]["informations"]["type"] == "int" and
+ configurationInfos[name]["value"].find("L") != -1):
+ configurationInfos[name]["informations"]["long"] = True
+ configurationInfos[name]["value"] = configurationInfos[name]["value"].replace("L", "")
+ if ("type" in configurationInfos[name]["informations"].keys() and
+ configurationInfos[name]["informations"]["type"] == "int" and
+ configurationInfos[name]["value"].find("U") != -1):
+ configurationInfos[name]["informations"]["unsigned"] = True
+ configurationInfos[name]["value"] = configurationInfos[name]["value"].replace("U", "")
+ configurationInfos[name]["description"] = description
+ configurationInfos[name]["brief"] = brief
+ return configurationInfos
def sub(string, parameter, value):
"""