4 # Copyright 2009 Develer S.r.l. (http://www.develer.com/)
9 # Author: Lorenzo Berni <duplo@develer.com>
16 def clFiles(file_dict, directory):
18 filelist.append("<VirtualDirectory Name=\"%s\">" %os.path.basename(directory))
19 for f in file_dict[directory]["files"]:
20 filelist.append("<File Name=\"%s\"/>" %os.path.join(directory, f))
21 for d in file_dict[directory]["dirs"]:
22 filelist += clFiles(file_dict, os.path.join(directory, d))
23 filelist.append("</VirtualDirectory>")
26 def findSources(path):
28 for root, dirs, files in os.walk(path):
29 if root.find("svn") == -1:
30 file_dict[root] = {"dirs": [], "files": []}
32 if dir.find("svn") == -1:
33 file_dict[root]["dirs"].append(dir)
35 if file.endswith(const.EXTENSION_FILTER):
36 file_dict[root]["files"].append(file)
39 def codeliteProjectGenerator(project_info):
40 template = open("cltemplates/bertos.project").read()
41 filelist = "\n".join(clFiles(findSources(project_info.info("PROJECT_PATH")), project_info.info("PROJECT_PATH")))
42 while template.find("$filelist") != -1:
43 template = template.replace("$filelist", filelist)
44 project_name = os.path.basename(project_info.info("PROJECT_PATH"))
45 while template.find("$project") != -1:
46 template = template.replace("$project", project_name)
49 def codeliteWorkspaceGenerator(project_info):
50 template = open("cltemplates/bertos.workspace").read()
51 project_name = os.path.basename(project_info.info("PROJECT_PATH"))
52 while template.find("$project") != -1:
53 template = template.replace("$project", project_name)