From: duplo Date: Mon, 9 Mar 2009 10:18:17 +0000 (+0000) Subject: Create workspace and project file for codelite X-Git-Tag: 2.1.0~295 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=6b50178e731ae6a8330bacb73fa584c78ccb906c;p=bertos.git Create workspace and project file for codelite git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2387 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index 1066f034..3c7407bf 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -67,6 +67,10 @@ def createBertosProject(projectInfo): makefile = open("mktemplates/template.mk", "r").read() makefile = mkGenerator(projectInfo, makefile) open(prjdir + "/" + os.path.basename(prjdir) + ".mk", "w").write(makefile) + workspace = codeliteWorkspaceGenerator(projectInfo) + open(directory + "/" + os.path.basename(prjdir) + ".workspace", "w").write(workspace) + project = codeliteProjectGenerator(projectInfo) + open(directory + "/" + os.path.basename(prjdir) + ".project", "w").write(project) def mkGenerator(projectInfo, makefile): """ @@ -108,6 +112,43 @@ def csrcGenerator(projectInfo): files.append(path + "/" + filename) csrc = " \\\n\t".join(files) + " \\" return csrc + +def clFiles(fileDict, directory): + filelist = [] + filelist.append("" %os.path.basename(directory)) + for f in fileDict[directory]["files"]: + filelist.append("" %os.path.join(directory, f)) + for d in fileDict[directory]["dirs"]: + filelist += clFiles(fileDict, os.path.join(directory, d)) + filelist.append("") + return filelist + +def findSources(path): + fileDict = {} + for root, dirs, files in os.walk(path): + if root.find("svn") == -1: + fileDict[root] = {"dirs": [], "files": []} + for dir in dirs: + if dir.find("svn") == -1: + fileDict[root]["dirs"].append(dir) + for file in files: + if file.endswith(const.EXTENSION_FILTER): + fileDict[root]["files"].append(file) + return fileDict + +def codeliteProjectGenerator(projectInfo): + template = open("cltemplates/bertos.project").read() + filelist = "\n".join(clFiles(findSources(projectInfo.info("PROJECT_PATH")), projectInfo.info("PROJECT_PATH"))) + while template.find("$filelist") != -1: + template = template.replace("$filelist", filelist) + return template + +def codeliteWorkspaceGenerator(projectInfo): + template = open("cltemplates/bertos.workspace").read() + projectName = os.path.basename(projectInfo.info("PROJECT_PATH")) + while template.find("$project") != -1: + template = template.replace("$project", projectName) + return template def getSystemPath(): path = os.environ["PATH"] diff --git a/wizard/cltemplates/bertos.project b/wizard/cltemplates/bertos.project new file mode 100644 index 00000000..a865056b --- /dev/null +++ b/wizard/cltemplates/bertos.project @@ -0,0 +1,62 @@ + + +$filelist + + + + + + + + + + + + + + + + + + make clean + make + + + + None + $(WorkspacePath) + + + + + + + + + + + + + + + + + + + + + make clean + make + + + + None + $(WorkspacePath) + + + + + + + + diff --git a/wizard/cltemplates/bertos.workspace b/wizard/cltemplates/bertos.workspace new file mode 100644 index 00000000..4b9d7957 --- /dev/null +++ b/wizard/cltemplates/bertos.workspace @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/wizard/const.py b/wizard/const.py index 8902d4bb..86115373 100644 --- a/wizard/const.py +++ b/wizard/const.py @@ -29,7 +29,7 @@ CPU_DEF = { "CPU_DESC" : [] } -TOOLCHAIN_ITEMS = ["ld", "as"] +TOOLCHAIN_ITEMS = ("ld", "as") CPU_DEFINITION = "*.cdef" @@ -37,4 +37,12 @@ GCC_NAME = "*gcc*" MODULE_CONFIGURATION = "cfg_*.h" -UI_LOCATION = "ui" \ No newline at end of file +UI_LOCATION = "ui" + +EXTENSION_FILTER = ( + ".c", + ".cpp", + ".cxx", + ".h", + ".c++", +) \ No newline at end of file