changeset 332:87feb8a23b4d

Added task list command
author Windel Bouwman
date Fri, 07 Feb 2014 12:51:55 +0100
parents a78b41ff6ad2
children dcae6574c974
files python/ppci/buildtasks.py python/ppci/tasks.py python/zcc.py readme.rst
diffstat 4 files changed, 17 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/python/ppci/buildtasks.py	Fri Feb 07 12:39:59 2014 +0100
+++ b/python/ppci/buildtasks.py	Fri Feb 07 12:51:55 2014 +0100
@@ -80,13 +80,4 @@
     pass
 
 
-def load_recipe(recipe_file, runner):
-    """ Loads a recipe dictionary into a task runner """
-    for command, value in recipe:
-        if command == 'compile':
-            sources = value['']
-            target = value['target']
-            runner.add_task(Compile())
-        else:
-            raise Exception()
 
--- a/python/ppci/tasks.py	Fri Feb 07 12:39:59 2014 +0100
+++ b/python/ppci/tasks.py	Fri Feb 07 12:51:55 2014 +0100
@@ -27,11 +27,15 @@
         self.dependencies.append(task)
         return task
 
+    def __repr__(self):
+        return 'Task "{}"'.format(self.name)
+
 
 class TaskRunner:
+    """ Basic task runner that can run some tasks in sequence """
     def __init__(self):
         self.task_list = []
-    
+
     def add_task(self, task):
         self.task_list.append(task)
 
@@ -44,3 +48,8 @@
             print('Error: {}'.format(e))
             return 1
         return 0
+
+    def display(self):
+        """ Display task how they would be run """
+        for task in self.task_list:
+            print(task)
--- a/python/zcc.py	Fri Feb 07 12:39:59 2014 +0100
+++ b/python/zcc.py	Fri Feb 07 12:51:55 2014 +0100
@@ -30,6 +30,7 @@
 
     parser.add_argument('--log', help='Log level (INFO,DEBUG,[WARN])',
                         type=logLevel, default='WARN')
+    parser.add_argument('--display-build-steps', action='store_true')
     sub_parsers = parser.add_subparsers(title='commands',
          description='possible commands', dest='command')
     recipe_parser = sub_parsers.add_parser('recipe', help="Bake recipe")
@@ -103,7 +104,11 @@
     else:
         raise NotImplementedError('Invalid option')
 
-    res = runner.run_tasks()
+    if args.display_build_steps:
+        runner.display()
+        res = 0
+    else:
+        res = runner.run_tasks()
 
     logging.getLogger().removeHandler(ch)
     return res
--- a/readme.rst	Fri Feb 07 12:39:59 2014 +0100
+++ b/readme.rst	Fri Feb 07 12:51:55 2014 +0100
@@ -19,6 +19,7 @@
 ---------------------
 
 * python3.3
+* pyyaml for yaml module
 * (optional) pyqt5, pyqt4 or pyside
 
 How to start the IDE