Change SOURCES_PATH in BERTOS_PATH.
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 26 Apr 2010 13:48:10 +0000 (13:48 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 26 Apr 2010 13:48:10 +0000 (13:48 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3515 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BCreationPage.py
wizard/BEditingDialog.py
wizard/BProject.py
wizard/BVersionPage.py
wizard/_wizard_version.py
wizard/bertos.py
wizard/bertos_utils.py
wizard/test/testCpuTagsImport.py
wizard/test/testLoadProjectPresets.py
wizard/test/testModulePage.py

index 1d48ac3030e82331d89d1c2fde9a02fd671bda94..225aa2e29c7944e78fd6e70d2647ada454cf5a9e 100644 (file)
@@ -65,7 +65,7 @@ class BCreationPage(BWizardPage):
         folder_item = QTreeWidgetItem(folder_title, QStringList([os.path.normpath(self.projectInfo("PROJECT_PATH"))]))
         top_level.append(folder_title)
         version_title = QTreeWidgetItem(QStringList([self.tr("BeRTOS version")]))
-        sources_path = self.projectInfo("SOURCES_PATH")
+        sources_path = self.projectInfo("BERTOS_PATH")
         version = QTreeWidgetItem(version_title, QStringList([self.tr("version: ") + bertos_utils.bertosVersion(sources_path)]))
         source_path = QTreeWidgetItem(version_title, QStringList([self.tr("path: ") + os.path.normpath(sources_path)]))
         top_level.append(version_title)
index 2a0b9798c7164f1ee4cd3908440e3ed837402630..f4cb468fbf2e68790dca050284a1690350577f9c 100644 (file)
@@ -118,7 +118,7 @@ class BEditingDialog(QDialog):
             dialog.toolchain_page.setProjectInfo("TOOLCHAIN", toolchain)
     
     def changeBertosVersion(self):
-       current_version = self.module_page.projectInfo("SOURCES_PATH")
+       current_version = self.module_page.projectInfo("BERTOS_PATH")
         dialog = BVersionDialog()
         if dialog.exec_():
             version = qvariant_converter.getString(dialog.version_page.currentItem().data(Qt.UserRole))
@@ -130,8 +130,8 @@ class BEditingDialog(QDialog):
             ) == QMessageBox.Ok:
                 try:
                     qApp.setOverrideCursor(QCursor(Qt.WaitCursor))
-                    dialog.version_page.setProjectInfo("SOURCES_PATH", version)
-                    dialog.version_page.setProjectInfo("OLD_SOURCES_PATH", current_version)
+                    dialog.version_page.setProjectInfo("BERTOS_PATH", version)
+                    dialog.version_page.setProjectInfo("OLD_BERTOS_PATH", current_version)
                     enabled_modules = bertos_utils.enabledModules(dialog.version_page.project)
                     old_configuration = dialog.version_page.projectInfo("CONFIGURATIONS")
                     dialog.version_page.project.loadSourceTree()
@@ -152,7 +152,7 @@ class BEditingDialog(QDialog):
                     qApp.restoreOverrideCursor()
             else:
                 # Rollback version to the previous selected one.
-                dialog.version_page.setProjectInfo("SOURCES_PATH", current_version)
+                dialog.version_page.setProjectInfo("BERTOS_PATH", current_version)
 
     def apply(self):
         try:
@@ -175,10 +175,10 @@ class BEditingDialog(QDialog):
         return self.module_page.versions()
 
     def currentVersion(self):
-        return self.module_page.projectInfo("SOURCES_PATH")
+        return self.module_page.projectInfo("BERTOS_PATH")
     
     def setCurrentVersion(self, version):
-        self.module_page.setProjectInfo("SOURCES_PATH", version)
+        self.module_page.setProjectInfo("BERTOS_PATH", version)
 
 class BToolchainDialog(QDialog):
     def __init__(self):
@@ -228,7 +228,7 @@ class BVersionDialog(QDialog):
         layout.addLayout(button_layout)
         self.setLayout(layout)
         self.connect(ok_button, SIGNAL("clicked()"), self.accept)
-        current_version = version_page.projectInfo("SOURCES_PATH")
+        current_version = version_page.projectInfo("BERTOS_PATH")
         self.setWindowTitle(self.tr("Change BeRTOS version"))
 
 
index 3129857e3fa8ffcf46b409209a6d6dd6443fc073..decb64686c62cc59988b52beb7839ba4f1ead265 100644 (file)
@@ -93,14 +93,14 @@ class BProject(object):
 
         wizard_version = project_data.get("WIZARD_VERSION", 0)
         if wizard_version < 1:
-            # Ignore the SOURCES_PATH inside the project file for older project
-            project_data["SOURCES_PATH"] = project_dir
+            # Ignore the BERTOS_PATH inside the project file for older project
+            project_data["BERTOS_PATH"] = project_dir
         else:
-            linked_sources_path = project_data["SOURCES_PATH"]
+            linked_sources_path = project_data["BERTOS_PATH"]
             sources_abspath = os.path.abspath(os.path.join(project_dir, linked_sources_path))
-            project_data["SOURCES_PATH"] = sources_abspath
+            project_data["BERTOS_PATH"] = sources_abspath
         
-        self._loadBertosSourceStuff(project_data["SOURCES_PATH"], info_dict.get("SOURCES_PATH", None))
+        self._loadBertosSourceStuff(project_data["BERTOS_PATH"], info_dict.get("BERTOS_PATH", None))
         
         self.infos["PRESET"] = project_data.get("PRESET", False)
 
@@ -120,7 +120,7 @@ class BProject(object):
         if forced_version:
             sources_path = forced_version
         if os.path.exists(sources_path):
-            self.infos["SOURCES_PATH"] = sources_path
+            self.infos["BERTOS_PATH"] = sources_path
         else:
             raise VersionException(self)
 
@@ -193,7 +193,7 @@ class BProject(object):
         Load the default presets (into the const.PREDEFINED_BOARDS_DIR).
         """
         # NOTE: this method does nothing (for now).
-        preset_path = os.path.join(self.infos["SOURCES_PATH"], const.PREDEFINED_BOARDS_DIR)
+        preset_path = os.path.join(self.infos["BERTOS_PATH"], const.PREDEFINED_BOARDS_DIR)
         preset_tree = {}
         if os.path.exists(preset_path):
             preset_tree = self._loadProjectPresetTree(preset_path)
@@ -246,9 +246,9 @@ class BProject(object):
                     if "configuration" in information and len(information["configuration"]):
                         configuration = module_dict[module]["configuration"]
                         try:
-                            configuration_info[configuration] = loadConfigurationInfos(self.infos["SOURCES_PATH"] + "/" + configuration)
+                            configuration_info[configuration] = loadConfigurationInfos(self.infos["BERTOS_PATH"] + "/" + configuration)
                         except ParseError, err:
-                            raise DefineException.ConfigurationDefineException(self.infos["SOURCES_PATH"] + "/" + configuration, err.line_number, err.line)
+                            raise DefineException.ConfigurationDefineException(self.infos["BERTOS_PATH"] + "/" + configuration, err.line_number, err.line)
                         if edit:
                             try:
                                 path = self.infos["PROJECT_SRC_PATH"]
@@ -277,8 +277,8 @@ class BProject(object):
         """
         Index BeRTOS source and load it in memory.
         """
-        # Index only the SOURCES_PATH/bertos content
-        bertos_sources_dir = os.path.join(self.info("SOURCES_PATH"), "bertos")
+        # Index only the BERTOS_PATH/bertos content
+        bertos_sources_dir = os.path.join(self.info("BERTOS_PATH"), "bertos")
         file_dict = {}
         if os.path.exists(bertos_sources_dir):
             for element in os.walk(bertos_sources_dir):
@@ -490,11 +490,11 @@ class BProject(object):
 
     @property
     def old_srcdir(self):
-        return self.infos.get("OLD_SOURCES_PATH", None)
+        return self.infos.get("OLD_BERTOS_PATH", None)
 
     @property
     def sources_dir(self):
-        return self.infos.get("SOURCES_PATH", None)
+        return self.infos.get("BERTOS_PATH", None)
 
     @property
     def from_preset(self):
@@ -541,8 +541,8 @@ class BProject(object):
         return [(filename, dirname) for dirname in file_dict.get(filename, [])]
 
     def findDefinitions(self, ftype):
-        # Maintain a cache for every scanned SOURCES_PATH
-        definitions_dict = self._cached_queries.get(self.infos["SOURCES_PATH"], {})
+        # Maintain a cache for every scanned BERTOS_PATH
+        definitions_dict = self._cached_queries.get(self.infos["BERTOS_PATH"], {})
         definitions = definitions_dict.get(ftype, None)
         if definitions is not None:
             return definitions
@@ -552,11 +552,11 @@ class BProject(object):
             if fnmatch.fnmatch(filename, ftype):
                 definitions += [(filename, dirname) for dirname in file_dict.get(filename, [])]
 
-        # If no cache for the current SOURCES_PATH create an empty one
+        # If no cache for the current BERTOS_PATH create an empty one
         if not definitions_dict:
-            self._cached_queries[self.infos["SOURCES_PATH"]] = {}
+            self._cached_queries[self.infos["BERTOS_PATH"]] = {}
         # Fill the empty cache with the result
-        self._cached_queries[self.infos["SOURCES_PATH"]][ftype] = definitions
+        self._cached_queries[self.infos["BERTOS_PATH"]][ftype] = definitions
         return definitions
 
     def setEnabledModules(self, enabled_modules):
index 452e8a947309637d75906199b3ae0674894157e8..7c205554e685c2fa08c4fe61d80302c694065fac 100644 (file)
@@ -65,7 +65,7 @@ class BVersionPage(BWizardPage):
             # Remove the trailing slash
             if sources_path.endswith(os.sep):
                 sources_path = sources_path[:-1]
-            self.setProjectInfo("SOURCES_PATH", sources_path)
+            self.setProjectInfo("BERTOS_PATH", sources_path)
             return True
         else:
             return False
@@ -193,12 +193,12 @@ class BVersionPage(BWizardPage):
         """
         versions = set([])
         if self._edit:
-            versions.add(self.projectInfo("SOURCES_PATH"))
+            versions.add(self.projectInfo("BERTOS_PATH"))
         if os.name == "nt":
             import winreg_importer
             versions |= set([os.path.normpath(dir) for dir in winreg_importer.getBertosDirs()])
         versions |= set([os.path.normpath(dir) for dir in self.versions()])
-        selected = self.projectInfo("SOURCES_PATH")
+        selected = self.projectInfo("BERTOS_PATH")
         for directory in versions:
             item = self.insertListElement(directory)
             if selected and selected == directory:
index da5745075e22ad399754d5b30e069a03183a7685..c262e383820429b70a81cb0f3e65b51f70730ae8 100644 (file)
@@ -39,7 +39,7 @@
 # Previous versions:
 #   0 - the project file doesn't contain the version number.
 #       When the current Wizard is opening project done with this version of
-#       the Wizard it has to change the origina SOURCES_PATH to the local path
+#       the Wizard it has to change the origina BERTOS_PATH to the local path
 #   1 - this is the current version. No special behaviours needed.
 
 
index ce6bd30f2970f54904a220b8ea4982cc9466d4d1..c53674a9f7574baee2397b893732d35b9e357fef 100755 (executable)
@@ -96,7 +96,7 @@ def editProject(project_file):
             dialog = BVersionDialog()
             if dialog.exec_():
                 version = dialog.version_page.currentVersion()
-                info_dict["SOURCES_PATH"] = version
+                info_dict["BERTOS_PATH"] = version
             continue
         except ToolchainException, exc:
             QMessageBox.critical(
index 972438df4781643e7a69c757c38f8f134220aa08..d65a39b0a1448262dfa2b4576d4aaf203bb9472d 100644 (file)
@@ -111,13 +111,13 @@ def projectFileGenerator(project_info):
             enabled_modules.append(module)
     project_data["ENABLED_MODULES"] = enabled_modules
     if project_info.info("PRESET"):
-        # For presets save again the SOURCES_PATH into project file
+        # For presets save again the BERTOS_PATH into project file
         project_data["PRESET"] = True
-        project_data["SOURCES_PATH"] = project_info.info("SOURCES_PATH")
+        project_data["BERTOS_PATH"] = project_info.info("BERTOS_PATH")
     else:
         # Use the local BeRTOS version instead of the original one
-        # project_data["SOURCES_PATH"] = project_info.info("SOURCES_PATH")
-        project_data["SOURCES_PATH"] = directory
+        # project_data["BERTOS_PATH"] = project_info.info("BERTOS_PATH")
+        project_data["BERTOS_PATH"] = directory
     project_data["PROJECT_NAME"] = project_info.info("PROJECT_NAME", os.path.basename(directory))
     project_data["PROJECT_SRC_PATH"] = project_info.info("PROJECT_SRC_PATH")
     project_data["TOOLCHAIN"] = project_info.info("TOOLCHAIN")
@@ -134,7 +134,7 @@ def loadPlugin(plugin):
     return getattr(__import__("plugins", {}, {}, [plugin]), plugin)
 
 def versionFileGenerator(project_info, version_file):
-    version = bertosVersion(project_info.info("SOURCES_PATH"))
+    version = bertosVersion(project_info.info("BERTOS_PATH"))
     return version_file.replace('$version', version)
 
 def userMkGenerator(project_info, makefile):
@@ -252,13 +252,13 @@ def findModuleFiles(module, project_info):
     sfiles = []
     # .c files related to the module and the cpu architecture
     for filename, path in project_info.searchFiles(module + ".c"):
-        path = path.replace(project_info.info("SOURCES_PATH") + os.sep, "")
+        path = path.replace(project_info.info("BERTOS_PATH") + os.sep, "")
         path = replaceSeparators(path)
         cfiles.append(path + "/" + filename)
     # .s files related to the module and the cpu architecture
     for filename, path in project_info.searchFiles(module + ".s") + \
             project_info.searchFiles(module + ".S"):
-        path = path.replace(project_info.info("SOURCES_PATH") + os.sep, "")
+        path = path.replace(project_info.info("BERTOS_PATH") + os.sep, "")
         path = replaceSeparators(path)
         sfiles.append(path + "/" + filename)
     # .c and .s files related to the module and the cpu tags
@@ -267,7 +267,7 @@ def findModuleFiles(module, project_info):
     # Awful, but secure check for version
     # TODO: split me in a method/function
     try:
-        version_string = bertosVersion(project_info.info("SOURCES_PATH"))
+        version_string = bertosVersion(project_info.info("BERTOS_PATH"))
         version_list = [int(i) for i in version_string.split()[-1].split('.')]
         if version_list < [2, 5]:
             # For older versions of BeRTOS add the toolchain to the tags
@@ -278,13 +278,13 @@ def findModuleFiles(module, project_info):
 
     for tag in tags:
         for filename, path in project_info.searchFiles(module + "_" + tag + ".c"):
-            path = path.replace(project_info.info("SOURCES_PATH") + os.sep, "")
+            path = path.replace(project_info.info("BERTOS_PATH") + os.sep, "")
             if os.sep != "/":
                 path = replaceSeparators(path)
             cfiles.append(path + "/" + filename)
         for filename, path in project_info.searchFiles(module + "_" + tag + ".s") + \
                 project_info.searchFiles(module + "_" + tag + ".S"):
-            path = path.replace(project_info.info("SOURCES_PATH") + os.sep, "")
+            path = path.replace(project_info.info("BERTOS_PATH") + os.sep, "")
             path = replaceSeparators(path)
             sfiles.append(path + "/" + filename)
     return cfiles, sfiles
index 79e3c774a3aa4c1d265e686041bedd7138f9d1fa..df7491a1fc2b5d05f1a90a0d7b8d34f75b373f6c 100644 (file)
@@ -44,7 +44,7 @@ from bertos_utils import *
 
 def main():
     p = BProject.BProject()
-    p.setInfo("SOURCES_PATH", "../../")
+    p.setInfo("BERTOS_PATH", "../../")
     p.loadSourceTree()
     info = p.getCpuInfos()
     tags = getTagSet(info)
index 8076e9cc5c696606b8559c0befbaec7b2ef20b55..7167f39dce3cada8f3c7a6e06951e6dd81179d71 100644 (file)
@@ -44,7 +44,7 @@ from bertos_utils import *
 
 def main():
     p = BProject.BProject()
-    p.setInfo("SOURCES_PATH", "../../")
+    p.setInfo("BERTOS_PATH", "../../")
     p.loadProjectPresets()
 
 
index ce23fadeb36f620ef470e8ccdcde3a6939f32087..6b355984f6ed82fc643bb78e94ce692238c64c1a 100644 (file)
@@ -52,7 +52,7 @@ def main():
     app = QApplication([])
     app.project = BProject.BProject()
     page = BModulePage.BModulePage()
-    page.setProjectInfo("SOURCES_PATH", "../../")
+    page.setProjectInfo("BERTOS_PATH", "../../")
     page.setProjectInfo("CPU_INFOS", {"TOOLCHAIN": "avr", "CPU_TAGS": []})
     page.project().loadSourceTree()
     page.reloadData()