From: duplo Date: Mon, 9 Mar 2009 10:59:09 +0000 (+0000) Subject: Move to codelite_project module the codelite specific project creation functions X-Git-Tag: 2.1.0~294 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=68a9e7ea75691f889090a1c2b66891003f057e58;p=bertos.git Move to codelite_project module the codelite specific project creation functions git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2388 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index 3c7407bf..81ce7bbc 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -16,6 +16,7 @@ import re import shutil import const +import codelite_project import DefineException def isBertosDir(directory): @@ -113,32 +114,9 @@ def csrcGenerator(projectInfo): 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"))) + filelist = "\n".join(codelite_project.clFiles(codelite_project.findSources(projectInfo.info("PROJECT_PATH")), projectInfo.info("PROJECT_PATH"))) while template.find("$filelist") != -1: template = template.replace("$filelist", filelist) return template diff --git a/wizard/codelite_project.py b/wizard/codelite_project.py new file mode 100644 index 00000000..6b0974b6 --- /dev/null +++ b/wizard/codelite_project.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python +# encoding: utf-8 +# +# Copyright 2009 Develer S.r.l. (http://www.develer.com/) +# All rights reserved. +# +# $Id:$ +# +# Author: Lorenzo Berni +# + +import os + +import const + +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