self._moduleSelected(module)
else:
self._moduleUnselected(module)
+ self.removeFileDependencies(module)
def _moduleSelected(self, selectedModule):
modules = self._projectInfoRetrieve("MODULES")
def selectDependencyCheck(self, module):
unsatisfied = set()
modules = self._projectInfoRetrieve("MODULES")
+ files = self._projectInfoRetrieve("FILES")
for dependency in modules[module]["depends"]:
- if not modules[dependency]["enabled"]:
+ if dependency in modules and not modules[dependency]["enabled"]:
unsatisfied |= set([dependency])
if dependency not in unsatisfied:
unsatisfied |= self.selectDependencyCheck(dependency)
+ if dependency not in modules:
+ if dependency in files:
+ files[dependency] += 1
+ else:
+ files[dependency] = 1
+ self._projectInfoStore("FILES", files)
return unsatisfied
def unselectDependencyCheck(self, dependency):
if dependency not in unsatisfied:
unsatisfied |= self.unselectDependencyCheck(module)
return unsatisfied
+
+ def removeFileDependencies(self, module):
+ modules = self._projectInfoRetrieve("MODULES")
+ files = self._projectInfoRetrieve("FILES")
+ dependencies = modules[module]["depends"]
+ for dependency in dependencies:
+ if dependency in files:
+ files[dependency] -= 1
+ if files[dependency] == 0:
+ del files[dependency]
+ self._projectInfoStore("FILES", files)
class QControlGroup(QObject):
def __init__(self):
mkData["$prefix"] = projectInfo.info("TOOLCHAIN")["path"].split("gcc")[0]
mkData["$suffix"] = projectInfo.info("TOOLCHAIN")["path"].split("gcc")[1]
mkData["$cross"] = projectInfo.info("TOOLCHAIN")["path"].split("gcc")[0]
- mkData["$main"] = projectInfo.info("PROJECT_PATH") + "/" + os.path.basename(projectInfo.info("PROJECT_PATH")) + "/main.c"
+ mkData["$main"] = os.path.basename(projectInfo.info("PROJECT_PATH")) + "/main.c"
for key in mkData:
while makefile.find(key) != -1:
makefile = makefile.replace(key, mkData[key])
def csrcGenerator(projectInfo):
modules = projectInfo.info("MODULES")
+ files = projectInfo.info("FILES")
if "harvard" in projectInfo.info("CPU_INFOS")["CPU_TAGS"]:
harvard = True
else:
csrc = []
pcsrc = []
constants = {}
+ moduleFiles = set([])
for module, information in modules.items():
if information["enabled"]:
if "constants" in information:
constants.update(information["constants"])
- for filename, path in findDefinitions(module + ".c", projectInfo):
- path = path.replace(projectInfo.info("SOURCES_PATH"), projectInfo.info("PROJECT_PATH"))
+ moduleFiles |= set(findModuleFiles(module, projectInfo))
+ for fileDependency in information["depends"]:
+ if fileDependency in files:
+ moduleFiles |= set(findModuleFiles(fileDependency, projectInfo))
+ for file in moduleFiles:
if not harvard or "harvard" not in information or information["harvard"] == "both":
- csrc.append(path + "/" + filename)
+ csrc.append(file)
if harvard and "harvard" in information:
- pcsrc.append(path + "/" + filename)
- for filename, path in findDefinitions(module + "_" + projectInfo.info("CPU_INFOS")["TOOLCHAIN"] + ".c", projectInfo):
- path = path.replace(projectInfo.info("SOURCES_PATH"), projectInfo.info("PROJECT_PATH"))
- if not harvard or "harvard" not in information or information["harvard"] == "both":
- csrc.append(path + "/" + filename)
- if harvard and "harvard" in information:
- pcsrc.append(path + "/" + filename)
- for tag in projectInfo.info("CPU_INFOS")["CPU_TAGS"]:
- for filename, path in findDefinitions(module + "_" + tag + ".c", projectInfo):
- path = path.replace(projectInfo.info("SOURCES_PATH"), projectInfo.info("PROJECT_PATH"))
- if not harvard or "harvard" not in information or information["harvard"] == "both":
- csrc.append(path + "/" + filename)
- if harvard and "harvard" in information:
- pcsrc.append(path + "/" + filename)
+ pcsrc.append(file)
csrc = " \\\n\t".join(csrc) + " \\"
pcsrc = " \\\n\t".join(pcsrc) + " \\"
constants = "\n".join([os.path.basename(projectInfo.info("PROJECT_PATH")) + "_" + key + " = " + str(value) for key, value in constants.items()])
return csrc, pcsrc, constants
+
+def findModuleFiles(module, projectInfo):
+ files = []
+ for filename, path in findDefinitions(module + ".c", projectInfo):
+ path = path.replace(projectInfo.info("SOURCES_PATH") + "/", "")
+ files.append(path + "/" + filename)
+ for filename, path in findDefinitions(module + "_" + projectInfo.info("CPU_INFOS")["TOOLCHAIN"] + ".c", projectInfo):
+ path = path.replace(projectInfo.info("SOURCES_PATH") + "/", "")
+ files.append(path + "/" + filename)
+ for tag in projectInfo.info("CPU_INFOS")["CPU_TAGS"]:
+ for filename, path in findDefinitions(module + "_" + tag + ".c", projectInfo):
+ path = path.replace(projectInfo.info("SOURCES_PATH") + "/", "")
+ files.append(path + "/" + filename)
+ return files
def codeliteProjectGenerator(projectInfo):
template = open("cltemplates/bertos.project").read()
moduleInfoDict = {}
listInfoDict = {}
configurationInfoDict = {}
+ fileDict = {}
for filename, path in findDefinitions("*.h", project):
commentList = getCommentList(open(path + "/" + filename, "r").read())
if len(commentList) > 0:
project.setInfo("MODULES", moduleInfoDict)
project.setInfo("LISTS", listInfoDict)
project.setInfo("CONFIGURATIONS", configurationInfoDict)
+ project.setInfo("FILES", fileDict)
def formatParamNameValue(text):
"""