diff options
Diffstat (limited to 'projgraph')
-rwxr-xr-x | projgraph | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -53,13 +53,31 @@ def any_dep(tasks, task, status): return False +def add_missing(tasks): + missing = {} + for task in tasks.values(): + for dep in task.get('depends', []): + if dep not in tasks: + missing[dep] = { + 'label': '{} IS MISSING'.format(dep), + } + tasks.update(missing) + def set_status(tasks): + add_missing(tasks) tasklist = list(tasks.values()) for task in tasklist: if 'status' not in task: task['status'] = unknown else: task['status'] = statuses[task['status']] + deps = [ + dep + for dep in task.get('depends', []) + if dep in tasks + ] + task['depends'] = deps + unknown_tasks = find_unknown(tasklist) while unknown_tasks: for t in unknown_tasks: @@ -81,7 +99,7 @@ if ikiwiki: else: print('digraph "project" {') -tasks = obj['tasks'] +tasks = obj.get('tasks', obj) set_status(tasks) for name, task in tasks.items(): print('{} [label="{}"]'.format(name, task['label'])) |