From 68a9e7ea75691f889090a1c2b66891003f057e58 Mon Sep 17 00:00:00 2001 From: duplo Date: Mon, 9 Mar 2009 10:59:09 +0000 Subject: [PATCH] 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 --- wizard/bertos_utils.py | 26 ++------------------------ wizard/codelite_project.py | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 24 deletions(-) create mode 100644 wizard/codelite_project.py 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 -- 2.25.1