X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2Fcompatibility.py;h=93d902ba4104bd900cf44ef85ad9911b9f5c6e31;hb=fb256b1f08e223e61a6356714be40876a28eeab2;hp=22cd4f70f4372aab06f344d1c95948d889d4d54f;hpb=c91dd2220f6f26607ddb6988db95005eafe068e0;p=bertos.git diff --git a/wizard/compatibility.py b/wizard/compatibility.py index 22cd4f70..93d902ba 100644 --- a/wizard/compatibility.py +++ b/wizard/compatibility.py @@ -28,7 +28,6 @@ # # Copyright 2010 Develer S.r.l. (http://www.develer.com/) # -# $Id$ # # Author: Lorenzo Berni # @@ -37,22 +36,23 @@ import const import os from bertos_utils import replaceSeparators, csrcGenerator -def _userMkGenerator(project_info, destination): +def _userMkGenerator(project_info): makefile = open(os.path.join(const.DATA_DIR, "mktemplates/old/template.mk"), "r").read() + destination = os.path.join(project_info.prjdir, os.path.basename(project_info.prjdir) + ".mk") # Deadly performances loss was here :( mk_data = {} mk_data["$pname"] = os.path.basename(project_info.info("PROJECT_PATH")) mk_data["$main"] = os.path.basename(project_info.info("PROJECT_PATH")) + "/main.c" for key in mk_data: - while makefile.find(key) != -1: - makefile = makefile.replace(key, mk_data[key]) + makefile = makefile.replace(key, mk_data[key]) open(destination, "w").write(makefile) -def _mkGenerator(project_info, destination): +def _mkGenerator(project_info): """ Generates the mk file for the current project. """ makefile = open(os.path.join(const.DATA_DIR, "mktemplates/old/template_wiz.mk"), "r").read() + destination = os.path.join(project_info.prjdir, os.path.basename(project_info.prjdir) + "_wiz.mk") mk_data = {} mk_data["$pname"] = project_info.info("PROJECT_NAME") mk_data["$cpuclockfreq"] = project_info.info("SELECTED_FREQ") @@ -66,18 +66,17 @@ def _mkGenerator(project_info, destination): mk_data["$suffix"] = replaceSeparators(project_info.info("TOOLCHAIN")["path"].split("gcc")[1]) mk_data["$main"] = os.path.basename(project_info.info("PROJECT_PATH")) + "/main.c" for key in mk_data: - while makefile.find(key) != -1: - makefile = makefile.replace(key, mk_data[key]) + makefile = makefile.replace(key, mk_data[key]) open(destination, "w").write(makefile) -def _makefileGenerator(project_info, destination): +def _makefileGenerator(project_info): """ Generate the Makefile for the current project. """ makefile = open(os.path.join(const.DATA_DIR, "mktemplates/old/Makefile"), "r").read() + destination = os.path.join(project_info.maindir, "Makefile") # TODO write a general function that works for both the mk file and the Makefile - while makefile.find("$pname") != -1: - makefile = makefile.replace("$pname", project_info.info("PROJECT_NAME")) + makefile = makefile.replace("$pname", project_info.info("PROJECT_NAME")) open(destination, "w").write(makefile) def updateProject(project_data):