| 1 |
|
| 2 |
DOIT_CONFIG = {'verbosity': 2} |
| 3 |
|
| 4 |
TASKS_MODULE = __import__('my_tasks') |
| 5 |
|
| 6 |
def task_do(): |
| 7 |
|
| 8 |
for name in dir(TASKS_MODULE): |
| 9 |
item = getattr(TASKS_MODULE, name) |
| 10 |
if not hasattr(item, 'task_metadata'): |
| 11 |
continue |
| 12 |
|
| 13 |
|
| 14 |
metadata = item.task_metadata |
| 15 |
|
| 16 |
|
| 17 |
metadata['name'] = item.__name__ |
| 18 |
|
| 19 |
|
| 20 |
class Sentinel(object): pass |
| 21 |
input_ = metadata.pop('input', Sentinel) |
| 22 |
output_ = metadata.pop('output', Sentinel) |
| 23 |
args = [] |
| 24 |
if input_ != Sentinel: |
| 25 |
metadata['file_dep'] = input_ |
| 26 |
args.append(input_) |
| 27 |
if output_ != Sentinel: |
| 28 |
metadata['targets'] = output_ |
| 29 |
args.append(output_) |
| 30 |
|
| 31 |
|
| 32 |
metadata['actions'] = [(item, args)] |
| 33 |
|
| 34 |
yield metadata |
| 35 |
|