doc: Various fixes to documentation infrastructure
[bertos.git] / wizard / plugins / codelite.py
index 543cb6d1498a4e9c1d3319e5d49ca0d8611756f3..f6555a8be406c8e823c2c6c514d4dfa7232287a0 100644 (file)
@@ -63,12 +63,16 @@ def clFiles(file_dict, directory):
     directory as the base folder.
     """
     filelist = []
-    filelist.append("<VirtualDirectory Name=\"%s\">" %os.path.basename(directory))
+    # Do not create an empty VDir.
+    # TODO: this is *really* ugly, but an empty VDir is worse
+    if directory:
+        filelist.append("<VirtualDirectory Name=\"%s\">" %os.path.basename(directory))
     for f in file_dict[directory]["files"]:
         filelist.append("<File Name=\"%s\"/>" %os.path.join(directory, f))
     for d in file_dict[directory]["dirs"]:
         filelist += clFiles(file_dict, os.path.join(directory, d))
-    filelist.append("</VirtualDirectory>")
+    if directory:
+        filelist.append("</VirtualDirectory>")
     return filelist
 
 def findSources(path):
@@ -83,10 +87,11 @@ def findSources(path):
         if root.find("svn") == -1:
             file_dict[root.replace(path, "")] = {"dirs": [], "files": []}
             for dir in dirs:
-                if dir.find("svn") == -1:
+                # TODO: place the directory name in a constant file.
+                if dir.find("svn") == -1 and dir != "images" and dir != "obj" and dir != "doc":
                     file_dict[root.replace(path, "")]["dirs"].append(dir)
             for file in files:
-                if file.endswith(const.EXTENSION_FILTER):
+                if file.endswith(const.EXTENSION_FILTER) and file != "buildrev.h":
                     file_dict[root.replace(path, "")]["files"].append(file)
     return file_dict
 
@@ -96,11 +101,17 @@ def codeliteProjectGenerator(project_info):
     """
     template = open("cltemplates/bertos.project", "r").read()
     filelist = "\n".join(clFiles(findSources(project_info.info("PROJECT_PATH")), ""))
+    debugger_path = project_info.info("TOOLCHAIN")["path"].replace("gcc", "gdb")
+    init_script = project_info.info("CPU_INFOS")["GDB_INIT_SCRIPT"]
     while template.find("$filelist") != -1:
         template = template.replace("$filelist", filelist)
     project_name = os.path.basename(project_info.info("PROJECT_PATH"))
     while template.find("$project") != -1:
         template = template.replace("$project", project_name)
+    while template.find("$debuggerpath") != -1:
+        template = template.replace("$debuggerpath", debugger_path)
+    while template.find("$initscript") != -1:
+        template = template.replace("$initscript", init_script)
     return template
 
 def codeliteWorkspaceGenerator(project_info):