Add information for advanced preset editing.
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 23 Apr 2010 13:09:34 +0000 (13:09 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 23 Apr 2010 13:09:34 +0000 (13:09 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3507 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BProject.py
wizard/bertos_utils.py

index edba9d661c029ecef64ae74ab33da37c4e37d745..06bdc43272567c83587290874d0fa870e5942780 100644 (file)
@@ -83,12 +83,18 @@ class BProject(object):
         self.infos["PROJECT_NAME"] = project_data.get("PROJECT_NAME", os.path.basename(project_dir))
         self.infos["PROJECT_PATH"] = os.path.dirname(project_file)
 
-        # Check for the Wizard version
-        wizard_version = project_data.get("WIZARD_VERSION", 0)
-        if wizard_version < 1:
-            # Ignore the SOURCES_PATH inside the project file for older projects
+        preset = project_data.get("PRESET", False)
+        if not preset:
+            # Ignore the SOURCES_PATH inside the project file if it's not setted as 'preset'
             project_data["SOURCES_PATH"] = project_dir
+        else:
+            linked_sources_path = project_data["SOURCES_PATH"]
+            sources_abspath = os.path.abspath(os.path.join(project_dir, linked_sources_path))
+            project_data["SOURCES_PATH"] = sources_abspath
+        
         self._loadBertosSourceStuff(project_data["SOURCES_PATH"], info_dict.get("SOURCES_PATH", None))
+        
+        self.infos["PRESET"] = preset
 
         # For those projects that don't have a VERSION file create a dummy one.
         if not isBertosDir(project_dir):
index 3957b6746b7b28e57bf3ac9aee53770040c59502..afb76d426f8e421a33f15c1393cceb08e4af878d 100644 (file)
@@ -110,9 +110,14 @@ def projectFileGenerator(project_info):
         if information["enabled"]:
             enabled_modules.append(module)
     project_data["ENABLED_MODULES"] = enabled_modules
-    # Use the local BeRTOS version instead of the original one
-    # project_data["SOURCES_PATH"] = project_info.info("SOURCES_PATH")
-    project_data["SOURCES_PATH"] = directory
+    if project_info.info("PRESET"):
+        # For presets save again the SOURCES_PATH into project file
+        project_data["PRESET"] = True
+        project_data["SOURCES_PATH"] = project_info.info("SOURCES_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["PROJECT_NAME"] = project_info.info("PROJECT_NAME", os.path.basename(directory))
     project_data["TOOLCHAIN"] = project_info.info("TOOLCHAIN")
     project_data["CPU_NAME"] = project_info.info("CPU_NAME")