mk_data["$ppath"] = relpath.relpath(project_info.info("PROJECT_SRC_PATH"), project_info.info("PROJECT_PATH"))
mk_data["$main"] = os.path.join("$(%s_SRC_PATH)" %project_info.info("PROJECT_NAME"), "main.c")
for key in mk_data:
- while makefile.find(key) != -1:
- makefile = makefile.replace(key, mk_data[key])
+ makefile = makefile.replace(key, mk_data[key])
open(destination, "w").write(makefile)
def mkGenerator(project_info):
mk_data["$prefix"] = replaceSeparators(project_info.info("TOOLCHAIN")["path"].split("gcc")[0])
mk_data["$suffix"] = replaceSeparators(project_info.info("TOOLCHAIN")["path"].split("gcc")[1])
for key in mk_data:
- while makefile.find(key) != -1:
- makefile = makefile.replace(key, mk_data[key])
+ makefile = makefile.replace(key, mk_data[key])
open(destination, "w").write(makefile)
def makefileGenerator(project_info):
mk_data["$pname"] = project_info.info("PROJECT_NAME")
mk_data["$ppath"] = os.path.basename(project_info.info("PROJECT_SRC_PATH"))
for key in mk_data:
- while makefile.find(key) != -1:
- makefile = makefile.replace(key, mk_data[key])
+ makefile = makefile.replace(key, mk_data[key])
open(destination, "w").write(makefile)
def csrcGenerator(project_info):
Replace the separators in the given path with unix standard separator.
"""
if os.sep != "/":
- while path.find(os.sep) != -1:
- path = path.replace(os.sep, "/")
+ path = path.replace(os.sep, "/")
return path
def getSystemPath():
mk_data["$pname"] = os.path.basename(project_info.info("PROJECT_PATH"))
mk_data["$main"] = os.path.basename(project_info.info("PROJECT_PATH")) + "/main.c"
for key in mk_data:
- while makefile.find(key) != -1:
- makefile = makefile.replace(key, mk_data[key])
+ makefile = makefile.replace(key, mk_data[key])
open(destination, "w").write(makefile)
def _mkGenerator(project_info):
mk_data["$suffix"] = replaceSeparators(project_info.info("TOOLCHAIN")["path"].split("gcc")[1])
mk_data["$main"] = os.path.basename(project_info.info("PROJECT_PATH")) + "/main.c"
for key in mk_data:
- while makefile.find(key) != -1:
- makefile = makefile.replace(key, mk_data[key])
+ makefile = makefile.replace(key, mk_data[key])
open(destination, "w").write(makefile)
def _makefileGenerator(project_info):
makefile = open(os.path.join(const.DATA_DIR, "mktemplates/old/Makefile"), "r").read()
destination = os.path.join(project_info.maindir, "Makefile")
# TODO write a general function that works for both the mk file and the Makefile
- while makefile.find("$pname") != -1:
- makefile = makefile.replace("$pname", project_info.info("PROJECT_NAME"))
+ makefile = makefile.replace("$pname", project_info.info("PROJECT_NAME"))
open(destination, "w").write(makefile)
def updateProject(project_data):
filelist = "\n".join(clFiles(findSources(project_info.info("PROJECT_PATH")), ""))
debugger_path = project_info.info("TOOLCHAIN")["path"].replace("gcc", "gdb")
init_script = project_info.info("CPU_INFOS")["GDB_INIT_SCRIPT"]
- while template.find("$filelist") != -1:
- template = template.replace("$filelist", filelist)
+ template = template.replace("$filelist", filelist)
project_name = os.path.basename(project_info.info("PROJECT_PATH"))
- while template.find("$project") != -1:
- template = template.replace("$project", project_name)
- while template.find("$debuggerpath") != -1:
- template = template.replace("$debuggerpath", debugger_path)
- while template.find("$initscript") != -1:
- template = template.replace("$initscript", init_script)
+ template = template.replace("$project", project_name)
+ template = template.replace("$debuggerpath", debugger_path)
+ template = template.replace("$initscript", init_script)
return template
def codeliteWorkspaceGenerator(project_info):
"""
template = open(os.path.join(const.DATA_DIR, "cltemplates/bertos.workspace"), "r").read()
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