projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Filter always the menu warning, for nightly test.
[bertos.git]
/
wizard
/
plugins
/
codelite.py
diff --git
a/wizard/plugins/codelite.py
b/wizard/plugins/codelite.py
index 543cb6d1498a4e9c1d3319e5d49ca0d8611756f3..156abe3c13fedf5883f861899bad389e2ad836b3 100644
(file)
--- a/
wizard/plugins/codelite.py
+++ b/
wizard/plugins/codelite.py
@@
-28,12
+28,11
@@
#
# Copyright 2008 Develer S.r.l. (http://www.develer.com/)
#
#
# Copyright 2008 Develer S.r.l. (http://www.develer.com/)
#
-# $Id$
#
# Author: Lorenzo Berni <duplo@develer.com>
#
#
# Author: Lorenzo Berni <duplo@develer.com>
#
-import os
+import os
, sys
import const
import const
@@
-63,12
+62,16
@@
def clFiles(file_dict, directory):
directory as the base folder.
"""
filelist = []
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))
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):
return filelist
def findSources(path):
@@
-79,14
+82,20
@@
def findSources(path):
if not path.endswith(os.sep):
path += os.sep
file_dict = {}
if not path.endswith(os.sep):
path += os.sep
file_dict = {}
- for root, dirs, files in os.walk(path):
+ # also follow all symlinks under POSIX OSes
+ if os.name == 'posix' and sys.version_info >= (2, 6):
+ file_list = os.walk(path, followlinks=True)
+ else:
+ file_list = os.walk(path)
+ for root, dirs, files in file_list:
if root.find("svn") == -1:
file_dict[root.replace(path, "")] = {"dirs": [], "files": []}
for dir in dirs:
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:
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
file_dict[root.replace(path, "")]["files"].append(file)
return file_dict
@@
-94,21
+103,22
@@
def codeliteProjectGenerator(project_info):
"""
Returns the string rapresenting the codelite project.
"""
"""
Returns the string rapresenting the codelite project.
"""
- template = open(
"cltemplates/bertos.project"
, "r").read()
+ template = open(
os.path.join(const.DATA_DIR, "cltemplates/bertos.project")
, "r").read()
filelist = "\n".join(clFiles(findSources(project_info.info("PROJECT_PATH")), ""))
filelist = "\n".join(clFiles(findSources(project_info.info("PROJECT_PATH")), ""))
- while template.find("$filelist") != -1:
- template = template.replace("$filelist", filelist)
+ debugger_path = project_info.info("TOOLCHAIN")["path"].replace("gcc", "gdb")
+ init_script = project_info.info("CPU_INFOS")["GDB_INIT_SCRIPT"]
+ template = template.replace("$filelist", filelist)
project_name = os.path.basename(project_info.info("PROJECT_PATH"))
project_name = os.path.basename(project_info.info("PROJECT_PATH"))
- while template.find("$project") != -1:
- template = template.replace("$project", project_name)
+ template = template.replace("$project", project_name)
+ template = template.replace("$debuggerpath", debugger_path)
+ template = template.replace("$initscript", init_script)
return template
def codeliteWorkspaceGenerator(project_info):
"""
Returns the string rapresentig the codelite workspace.
"""
return template
def codeliteWorkspaceGenerator(project_info):
"""
Returns the string rapresentig the codelite workspace.
"""
- template = open(
"cltemplates/bertos.workspace"
, "r").read()
+ template = open(
os.path.join(const.DATA_DIR, "cltemplates/bertos.workspace")
, "r").read()
project_name = os.path.basename(project_info.info("PROJECT_PATH"))
project_name = os.path.basename(project_info.info("PROJECT_PATH"))
- while template.find("$project") != -1:
- template = template.replace("$project", project_name)
+ template = template.replace("$project", project_name)
return template
return template