Fix for preset editing problems (bug #183).
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 15 Nov 2010 11:22:07 +0000 (11:22 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 15 Nov 2010 11:22:07 +0000 (11:22 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4556 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BProject.py
wizard/_wizard_version.py
wizard/bertos_utils.py
wizard/compatibility.py

index 1a7fb258d2e4289f97a8d0b68307edd30d152e80..2afcadf98946e5e2468061134c58043424d1b0e4 100644 (file)
@@ -94,6 +94,9 @@ class BProject(object):
             self.infos["PROJECT_SRC_PATH"] = os.path.join(self.infos["PROJECT_PATH"], self.infos["PROJECT_NAME"])
         self.infos["PROJECT_HW_PATH"] = os.path.join(self.infos["PROJECT_PATH"], project_data.get("PROJECT_HW_PATH", self.infos["PROJECT_PATH"]))
 
+        self.infos["PROJECT_SRC_PATH_FROM_MAKEFILE"] = project_data.get("PROJECT_SRC_PATH_FROM_MAKEFILE")
+        self.infos["PROJECT_HW_PATH_FROM_MAKEFILE"] = project_data.get("PROJECT_HW_PATH_FROM_MAKEFILE")
+
         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
index dd0c210b2bec216532f46904fb42b5ee72cc8f1b..38fc923da2322047d460b46e06c2995c7d6bcbea 100644 (file)
 #   1 - SOURCES_PATH used instead of BERTOS_PATH
 #   2 - Use the old makefile templates (into /mktemplates/old) and the old logic
 #       Instead of the new one.
-#   3 - Current version.
+#   3 - Use default PROJECT_SRC_PATH_FROM_MAKEFILE and PROJECT_HW_PATH_FROM_MAKEFILE
+#   4 - Current version.
+#
 
 
 # NOTE: Change this variable may cause the wizard to not work properly. 
-WIZARD_VERSION = 3
+WIZARD_VERSION = 4
index 619371ad663ca60c6e8097c735f79c232ec3cf0f..8a3c771208ea3d99fd9d75864e6bccc2d11da713 100644 (file)
@@ -133,6 +133,7 @@ def projectFileGenerator(project_info):
     project_data["PROJECT_NAME"] = project_info.info("PROJECT_NAME", os.path.basename(directory))
     project_src_relpath = relpath.relpath(project_info.info("PROJECT_SRC_PATH"), directory)
     project_data["PROJECT_SRC_PATH"] = project_src_relpath
+    project_data["PROJECT_SRC_PATH_FROM_MAKEFILE"] = project_info.info("PROJECT_SRC_PATH_FROM_MAKEFILE")
     project_data["TOOLCHAIN"] = project_info.info("TOOLCHAIN")
     project_data["CPU_NAME"] = project_info.info("CPU_NAME")
     project_data["SELECTED_FREQ"] = project_info.info("SELECTED_FREQ")
@@ -140,6 +141,7 @@ def projectFileGenerator(project_info):
     project_data["WIZARD_VERSION"] = WIZARD_VERSION
     project_data["PRESET"] = project_info.info("PRESET")
     project_data["PROJECT_HW_PATH"] = relpath.relpath(project_info.info("PROJECT_HW_PATH"), directory)
+    project_data["PROJECT_HW_PATH_FROM_MAKEFILE"] = project_info.info("PROJECT_HW_PATH_FROM_MAKEFILE")
     return pickle.dumps(project_data)
 
 def loadPlugin(plugin):
@@ -170,7 +172,7 @@ def userMkGenerator(project_info):
     # Deadly performances loss was here :(
     mk_data = {}
     mk_data["$pname"] = os.path.basename(project_info.info("PROJECT_PATH"))
-    mk_data["$ppath"] = relpath.relpath(project_info.info("PROJECT_SRC_PATH"), project_info.info("PROJECT_PATH"))
+    mk_data["$ppath"] = project_info.info("PROJECT_SRC_PATH_FROM_MAKEFILE")
     mk_data["$main"] = "/".join(["$(%s_SRC_PATH)" %project_info.info("PROJECT_NAME"), "main.c"])
     for key in mk_data:
         makefile = makefile.replace(key, mk_data[key])
@@ -185,7 +187,7 @@ def mkGenerator(project_info):
     destination = os.path.join(prjdir, os.path.basename(prjdir) + ".mk")
     mk_data = {}
     mk_data["$pname"] = project_info.info("PROJECT_NAME")
-    mk_data["$ppath"] = relpath.relpath(project_info.info("PROJECT_SRC_PATH"), project_info.info("PROJECT_PATH"))
+    mk_data["$ppath"] = project_info.info("PROJECT_SRC_PATH_FROM_MAKEFILE")
     mk_data["$cpuclockfreq"] = project_info.info("SELECTED_FREQ")
     cpu_mk_parameters = []
     for key, value in project_info.info("CPU_INFOS").items():
@@ -195,7 +197,7 @@ def mkGenerator(project_info):
     mk_data["$csrc"], mk_data["$pcsrc"], mk_data["$cppasrc"], mk_data["$cxxsrc"], mk_data["$asrc"], mk_data["$constants"] = csrcGenerator(project_info)
     mk_data["$prefix"] = replaceSeparators(project_info.info("TOOLCHAIN")["path"].rsplit("gcc", 1)[0])
     mk_data["$suffix"] = replaceSeparators(project_info.info("TOOLCHAIN")["path"].rsplit("gcc", 1)[1])
-    mk_data["$hwpath"] = relpath.relpath(project_info.info("PROJECT_HW_PATH"), project_info.info("PROJECT_PATH"))
+    mk_data["$hwpath"] = project_info.info("PROJECT_HW_PATH_FROM_MAKEFILE")
     for key in mk_data:
         makefile = makefile.replace(key, mk_data[key])
     open(destination, "w").write(makefile)
@@ -209,7 +211,7 @@ def makefileGenerator(project_info):
     # TODO write a general function that works for both the mk file and the Makefile
     mk_data = {}
     mk_data["$pname"] = project_info.info("PROJECT_NAME")
-    mk_data["$ppath"] = relpath.relpath(project_info.info("PROJECT_SRC_PATH"), project_info.info("PROJECT_PATH"))
+    mk_data["$ppath"] = project_info.info("PROJECT_SRC_PATH_FROM_MAKEFILE")
     for key in mk_data:
         makefile = makefile.replace(key, mk_data[key])
     open(destination, "w").write(makefile)
index 24a0805545f4c0fc13f68739461726fd058e71aa..bf2f635a78c217bec84ecd0867ae73fb85aaaade 100644 (file)
@@ -97,5 +97,10 @@ def updateProject(project_data):
         bertos_utils.mkGenerator = _mkGenerator
         bertos_utils.userMkGenerator = _userMkGenerator
         bertos_utils.makefileGenerator = _makefileGenerator
+    if wizard_version < 4:
+        # Use default PROJECT_SRC_PATH_FROM_MAKEFILE and
+        # PROJECT_HW_PATH_FROM_MAKEFILE
+        project_data["PROJECT_SRC_PATH_FROM_MAKEFILE"] = project_data["PROJECT_SRC_PATH"]
+        project_data["PROJECT_HW_PATH_FROM_MAKEFILE"] = project_data["PROJECT_HW_PATH"]
     return project_data