X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2Fbertos_utils.py;h=05fd35465c5901119c9fea424dfcc409e9e204e2;hb=24cb311b180d96e12fa70cb063b044a550780bc0;hp=6fbd254acdb6d52f8d1d528c853bcda9944dda20;hpb=4bd6a37ba9ce30f09fb73d7006c77524c558993b;p=bertos.git diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index 6fbd254a..05fd3546 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -39,7 +39,9 @@ def createBertosProject(projectInfos): makefile = directory + "/Makefile" if os.path.exists(makefile): os.remove(makefile) - shutil.copy(sourcesDir + "/Makefile", makefile) + makefile = open("mktemplates/Makefile").read() + makefile = makefileGenerator(makefile) + open(directory + "/Makefile", "w").write(makefile) ## Destination project dir prjdir = directory + "/" + os.path.basename(directory) shutil.rmtree(prjdir, True) @@ -61,7 +63,7 @@ def createBertosProject(projectInfos): ## Destinatio mk file makefile = open("mktemplates/template.mk", "r").read() makefile = mkGenerator(projectInfos, makefile) - open(prjdir + "/" + "template.mk", "w").write(makefile) + open(prjdir + "/" + "project.mk", "w").write(makefile) def mkGenerator(projectInfos, makefile): """ @@ -77,6 +79,15 @@ def mkGenerator(projectInfos, makefile): makefile = makefile.replace(key, mkData[key]) return makefile +def makefileGenerator(projectInfos, makefile): + """ + Generate the Makefile for the current project. + """ + # TODO: write a general function that works for both the mk file and the Makefile + while makefile.find("project_name") != -1: + makefile = makefile.replace("project_name", os.path.basename(projectInfos.info("PROJECT_PATH"))) + return makefile + def getSystemPath(): path = os.environ["PATH"] if os.name == "nt":