From: duplo Date: Mon, 15 Nov 2010 11:22:07 +0000 (+0000) Subject: Fix for preset editing problems (bug #183). X-Git-Tag: 2.7.0~380 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=68e4e9905f22d675da72650b8d13c9d69c5b264f;p=bertos.git Fix for preset editing problems (bug #183). git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4556 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/wizard/BProject.py b/wizard/BProject.py index 1a7fb258..2afcadf9 100644 --- a/wizard/BProject.py +++ b/wizard/BProject.py @@ -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 diff --git a/wizard/_wizard_version.py b/wizard/_wizard_version.py index dd0c210b..38fc923d 100644 --- a/wizard/_wizard_version.py +++ b/wizard/_wizard_version.py @@ -42,8 +42,10 @@ # 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 diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index 619371ad..8a3c7712 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -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) diff --git a/wizard/compatibility.py b/wizard/compatibility.py index 24a08055..bf2f635a 100644 --- a/wizard/compatibility.py +++ b/wizard/compatibility.py @@ -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