aboutsummaryrefslogtreecommitdiff
path: root/ips/task.py
diff options
context:
space:
mode:
Diffstat (limited to 'ips/task.py')
-rw-r--r--ips/task.py39
1 files changed, 19 insertions, 20 deletions
diff --git a/ips/task.py b/ips/task.py
index 6c84d51..1d8faeb 100644
--- a/ips/task.py
+++ b/ips/task.py
@@ -1,17 +1,18 @@
-# class TaskController(list):
-# def __init__(self):
-# super(TaskController, self).__init__()
-# self._store = []
-#
-# def task(self, task):
-# super(TaskController, self).append(task)
-#
-# def do_tasks(self):
-# for task in super(TaskController, self).__iter__():
-# retval = task.run()
-# if not retval:
-# exit(retval)
-
+# This file is part of ipsutils.
+
+# ipsutils is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# ipsutils is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with ipsutils. If not, see <http://www.gnu.org/licenses/>.
+
class TaskController(object):
def __init__(self):
self.stack = []
@@ -21,20 +22,18 @@ class TaskController(object):
t: Task object
"""
self.stack.append(t)
-
+
def do_tasks(self):
""" FILO execution of tasks
"""
- #self.stack.reverse()
- for i in self.stack:
- i.run()
+ for stack_entry in self.stack:
+ stack_entry.run()
class NamedTask(object):
def __init__(self, name, func, *args):
self.name = name
self.task = func
self.task_args = args
- print("New task: {0:s} {1:s}".format(self.name, self.task))
def run(self):
print("Running task: {0:s}".format(self.name))
@@ -42,4 +41,4 @@ class NamedTask(object):
return status
class InternalTask(NamedTask):
- pass \ No newline at end of file
+ pass