X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2Fbertos_utils.py;h=4589de3bf8bd2ca767beff5b1bc9ae38474b778a;hb=adf4a56dc7329b8add0891e0ff11fca3f5add6f6;hp=217fe05a0037877f2cd0bb432f7a70bdb2eda8ae;hpb=c509e4175838e03bd9258d398af731be3a72e060;p=bertos.git diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index 217fe05a..4589de3b 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -138,19 +138,22 @@ def versionFileGenerator(project_info, version_file): version = bertosVersion(project_info.info("BERTOS_PATH")) return version_file.replace('$version', version) -def userMkGenerator(project_info, makefile): +def userMkGenerator(project_info, destination): + makefile = open(os.path.join(const.DATA_DIR, "mktemplates/template.mk"), "r").read() + # 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]) - return makefile + open(destination, "w").write(makefile) -def mkGenerator(project_info, makefile): +def mkGenerator(project_info, destination): """ Generates the mk file for the current project. """ + makefile = open(os.path.join(const.DATA_DIR, "mktemplates/template_wiz.mk"), "r").read() mk_data = {} mk_data["$pname"] = project_info.info("PROJECT_NAME") mk_data["$cpuclockfreq"] = project_info.info("SELECTED_FREQ") @@ -166,16 +169,17 @@ def mkGenerator(project_info, makefile): for key in mk_data: while makefile.find(key) != -1: makefile = makefile.replace(key, mk_data[key]) - return makefile + open(destination, "w").write(makefile) -def makefileGenerator(project_info, makefile): +def makefileGenerator(project_info, destination): """ Generate the Makefile for the current project. """ + makefile = open(os.path.join(const.DATA_DIR, "mktemplates/Makefile"), "r").read() # 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")) - return makefile + open(destination, "w").write(makefile) def csrcGenerator(project_info): modules = project_info.info("MODULES")