From 0933e5f9aeb914fea0d70921504e56b3a0db69a6 Mon Sep 17 00:00:00 2001 From: duplo Date: Tue, 10 Feb 2009 11:59:19 +0000 Subject: [PATCH] Store the file list in the project object git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2336 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/BCpuPage.py | 2 +- wizard/BModulePage.py | 4 ++-- wizard/bertos_utils.py | 23 ++++++++++++++--------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/wizard/BCpuPage.py b/wizard/BCpuPage.py index 2af1df82..17759b08 100644 --- a/wizard/BCpuPage.py +++ b/wizard/BCpuPage.py @@ -27,7 +27,7 @@ class BCpuPage(BWizardPage): def _populateCpuList(self): self.pageContent.cpuList.clear() self.pageContent.cpuList.setCurrentItem(None) - infos = bertos_utils.loadCpuInfos(self._projectInfoRetrieve("SOURCES_PATH")) + infos = bertos_utils.loadCpuInfos(self._project()) for cpu in infos: item = QListWidgetItem(cpu["CPU_NAME"]) item.setData(Qt.UserRole, qvariant_converter.convertDict(cpu)) diff --git a/wizard/BModulePage.py b/wizard/BModulePage.py index cf1340d0..a766b6a3 100644 --- a/wizard/BModulePage.py +++ b/wizard/BModulePage.py @@ -39,8 +39,8 @@ class BModulePage(BWizardPage): def _loadModuleData(self): try: - modules = bertos_utils.loadModuleInfosDict(self._projectInfoRetrieve("SOURCES_PATH")) - lists = bertos_utils.loadDefineListsDict(self._projectInfoRetrieve("SOURCES_PATH")) + modules = bertos_utils.loadModuleInfosDict(self._project()) + lists = bertos_utils.loadDefineListsDict(self._project()) configurations = {} for module, informations in modules.items(): if len(informations["configuration"]) > 0: diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index bcb4a4af..ad8277fa 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -133,16 +133,21 @@ def getToolchainInfo(output): info["thread"] = thread[0].split("Thread model: ")[1] return info -def findDefinitions(ftype, path): - L = os.walk(path) +def findDefinitions(ftype, project): + L = project.info("FILE_LIST") + if L is None: + L = [f for f in os.walk(project.info("SOURCES_PATH"))] + project.setInfo("FILE_LIST", L) + definitions = [] for element in L: for filename in element[2]: if fnmatch.fnmatch(filename, ftype): - yield (filename, element[0]) + definitions.append((filename, element[0])) + return definitions -def loadCpuInfos(path): +def loadCpuInfos(project): cpuInfos = [] - for definition in findDefinitions(const.CPU_DEFINITION, path): + for definition in findDefinitions(const.CPU_DEFINITION, project): cpuInfos.append(getInfos(definition)) return cpuInfos @@ -261,12 +266,12 @@ def loadModuleInfos(path): except SyntaxError: raise DefineException.ModuleDefineException(path) -def loadModuleInfosDict(path): +def loadModuleInfosDict(project): """ Return the dict containig all the modules """ moduleInfosDict = {} - for filename, path in findDefinitions("*.h", path): + for filename, path in findDefinitions("*.h", project): moduleInfosDict.update(loadModuleInfos(path + "/" + filename)) return moduleInfosDict @@ -288,12 +293,12 @@ def loadDefineLists(path): except SyntaxError: raise DefineException.EnumDefineException(path) -def loadDefineListsDict(path): +def loadDefineListsDict(project): """ Return the dict containing all the define lists """ defineListsDict = {} - for filename, path in findDefinitions("*.h", path): + for filename, path in findDefinitions("*.h", project): defineListsDict.update(loadDefineLists(path + "/" + filename)) return defineListsDict -- 2.25.1