Mercurial > lcfOS
diff python/ppci/buildtasks.py @ 393:6ae782a085e0
Added init program
author | Windel Bouwman |
---|---|
date | Sat, 17 May 2014 21:17:40 +0200 |
parents | d056b552d3f4 |
children |
line wrap: on
line diff
--- a/python/ppci/buildtasks.py Fri May 16 13:05:10 2014 +0200 +++ b/python/ppci/buildtasks.py Sat May 17 21:17:40 2014 +0200 @@ -4,10 +4,8 @@ Task can depend upon one another. """ -import logging - from .tasks import Task, TaskError, register_task -from .buildfunctions import c3compile, link, assemble, fix_object +from .buildfunctions import c3compile, link, assemble, fix_object, construct from pyyacc import ParserException from . import CompilerError @@ -36,9 +34,17 @@ self.target.project.set_property(name, value) +@register_task("build") +class ConstructTask(Task): + """ Builds another build description file (build.xml) """ + def run(self): + project = self.get_argument('file') + construct(project) + + @register_task("assemble") class AssembleTask(Task): - """ Task that can runs the assembler over the source and enters the + """ Task that can runs the assembler over the source and enters the output into an object file """ def run(self): @@ -73,8 +79,8 @@ output = c3compile(sources, includes, target) # Store output: - with open(output_filename, 'w') as f: - output.save(f) + with open(output_filename, 'w') as output_file: + output.save(output_file) @register_task("link") @@ -92,8 +98,8 @@ raise TaskError(e.msg) # Store output: - with open(output_filename, 'w') as f: - output_obj.save(f) + with open(output_filename, 'w') as output_file: + output_obj.save(output_file) @register_task("objcopy") @@ -105,6 +111,5 @@ obj = fix_object(object_filename) image = obj.get_image(image_name) - with open(output_filename, 'wb') as f: - f.write(image) - + with open(output_filename, 'wb') as output_file: + output_file.write(image)