Store the file list in the project object
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 10 Feb 2009 11:59:19 +0000 (11:59 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 10 Feb 2009 11:59:19 +0000 (11:59 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2336 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BCpuPage.py
wizard/BModulePage.py
wizard/bertos_utils.py

index 2af1df821f66429327b39ede313afc067798d182..17759b08485ab0071a3fc1ad7f0472d770bbc8cf 100644 (file)
@@ -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))
index cf1340d02b29295012d12f759e3afcc5b6b29390..a766b6a3dcf361bd126336352d27636e0702b226 100644 (file)
@@ -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:
index bcb4a4afc6e29a404f5668f97aff0b5a9a4d35e4..ad8277fa2010d98d5d46b5e0be8320e940a52915 100644 (file)
@@ -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