If the project edited is a preset the wizard doesn't add the following stuff:
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 26 Apr 2010 14:26:17 +0000 (14:26 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 26 Apr 2010 14:26:17 +0000 (14:26 +0000)
 * VERSION file (it's still copied, I'm investigating...)
 * Makefile
 * new sources
 * hw dir containing the hw files
 * autogenerated mk file
 * project files for the IDEs

git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3517 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BProject.py
wizard/bertos_utils.py

index 310d060216075a4e5b5c9e53dfa6b4159f7b6cf6..36fbd5c40e9002e33dd22531508cdcea3668ffaa 100644 (file)
@@ -98,10 +98,9 @@ class BProject(object):
         elif wizard_version == 1:
             # Use SOURCES_PATH instead of BERTOS_PATH for backward compatibility
             project_data["BERTOS_PATH"] = project_data["SOURCES_PATH"]
-        else:
-            linked_sources_path = project_data["BERTOS_PATH"]
-            sources_abspath = os.path.abspath(os.path.join(project_dir, linked_sources_path))
-            project_data["BERTOS_PATH"] = sources_abspath
+        linked_sources_path = project_data["BERTOS_PATH"]
+        sources_abspath = os.path.abspath(os.path.join(project_dir, linked_sources_path))
+        project_data["BERTOS_PATH"] = sources_abspath
         
         self._loadBertosSourceStuff(project_data["BERTOS_PATH"], info_dict.get("BERTOS_PATH", None))
         
@@ -355,22 +354,25 @@ class BProject(object):
     def _editBertosProject(self):
         # Write the project file
         self._writeProjectFile(os.path.join(self.maindir, "project.bertos"))
-        # VERSION file
-        self._writeVersionFile(os.path.join(self.maindir, "VERSION"))
-        # Destination makefile
-        self._writeMakefile(os.path.join(self.maindir, "Makefile"))
-        # Merge sources
-        self._mergeSources(self.sources_dir, self.srcdir, self.old_srcdir)
-        # Copy all the hw files
-        self._writeHwFiles(self.sources_dir, self.hwdir)
+        if not self.is_preset:
+            # Generate this files only if the project isn't a preset
+            # VERSION file
+            self._writeVersionFile(os.path.join(self.maindir, "VERSION"))
+            # Destination makefile
+            self._writeMakefile(os.path.join(self.maindir, "Makefile"))
+            # Merge sources
+            self._mergeSources(self.sources_dir, self.srcdir, self.old_srcdir)
+            # Copy all the hw files
+            self._writeHwFiles(self.sources_dir, self.hwdir)
+            # Destination wizard mk file
+            self._writeWizardMkFile(os.path.join(self.prjdir, os.path.basename(self.prjdir) + "_wiz.mk"))
         # Set properly the autoenabled parameters
         self._setupAutoenabledParameters()
         # Copy all the configuration files
         self._writeCfgFiles(self.sources_dir, self.cfgdir)
-        # Destination wizard mk file
-        self._writeWizardMkFile(os.path.join(self.prjdir, os.path.basename(self.prjdir) + "_wiz.mk"))
-        # Create project files for selected plugins
-        self._createProjectFiles()
+        if not self.is_preset:
+            # Create project files for selected plugins only if the project isn't a preset
+            self._createProjectFiles()
 
     def _createProjectFiles(self):
         # Files for selected plugins
@@ -503,6 +505,10 @@ class BProject(object):
     def from_preset(self):
         return self.infos.get("PROJECT_FROM_PRESET", False)
 
+    @property
+    def is_preset(self):
+        return self.infos.get("PRESET", False)
+
     def _createDirectory(self, directory):
         if not directory:
             return
index d65a39b0a1448262dfa2b4576d4aaf203bb9472d..217fe05a0037877f2cd0bb432f7a70bdb2eda8ae 100644 (file)
@@ -125,6 +125,7 @@ def projectFileGenerator(project_info):
     project_data["SELECTED_FREQ"] = project_info.info("SELECTED_FREQ")
     project_data["OUTPUT"] = project_info.info("OUTPUT")
     project_data["WIZARD_VERSION"] = WIZARD_VERSION
+    project_data["PRESET"] = project_info.info("PRESET")
     return pickle.dumps(project_data)
 
 def loadPlugin(plugin):