Debian Codegraph @

doc/samples/my_dodo.py

raw symbols SCIP
1
2 DOIT_CONFIG = {'verbosity': 2}
3
4 TASKS_MODULE = __import__('my_tasks')
5
6 def task_do():
7 # get functions that are tasks from module
8 for name in dir(TASKS_MODULE):
9 item = getattr(TASKS_MODULE, name)
10 if not hasattr(item, 'task_metadata'):
11 continue
12
13 # get task metadata attached to the function
14 metadata = item.task_metadata
15
16 # get name of task from function name
17 metadata['name'] = item.__name__
18
19 # *I* dont like the names file_dep, targets. So I use 'input', 'output'
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 # the action is the function iteself
32 metadata['actions'] = [(item, args)]
33
34 yield metadata
35