Avoid the double csrc list generation.
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 29 Mar 2010 14:06:41 +0000 (14:06 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 29 Mar 2010 14:06:41 +0000 (14:06 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3298 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/bertos_utils.py

index 4be3d536c1e4677e723c0218ce2e2043b9204550..808485b0cd1df4606374484faf46099279cfe3da 100644 (file)
@@ -236,7 +236,8 @@ def createBertosProject(project_info, edit=False):
     if not edit:
         # Destination user mk file (only on project creation)
         makefile = open(os.path.join(const.DATA_DIR, "mktemplates/template.mk"), "r").read()
-        makefile = mkGenerator(project_info, makefile)
+        # Deadly performances loss was here :(
+        makefile = userMkGenerator(project_info, makefile)
         open(prjdir + "/" + os.path.basename(prjdir) + ".mk", "w").write(makefile)
     # Destination wizard mk file
     makefile = open(os.path.join(const.DATA_DIR, "mktemplates/template_wiz.mk"), "r").read()
@@ -263,6 +264,14 @@ def versionFileGenerator(project_info, version_file):
     version = bertosVersion(project_info.info("SOURCES_PATH"))
     return version_file.replace('$version', version)
 
+def userMkGenerator(project_info, makefile):
+    mk_data = {}
+    mk_data["$pname"] = os.path.basename(project_info.info("PROJECT_PATH"))
+    for key in mk_data:
+        while makefile.find(key) != -1:
+            makefile = makefile.replace(key, mk_data[key])
+    return makefile
+
 def mkGenerator(project_info, makefile):
     """
     Generates the mk file for the current project.