/usr/share/doc/python-doit-doc/examples/tutorial/calc_dep.py is in python-doit-doc 0.25.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | DOIT_CONFIG = {'verbosity': 2}
MOD_IMPORTS = {'a': ['b','c'],
'b': ['f','g'],
'c': [],
'f': ['a'],
'g': []}
def print_deps(mod, dependencies):
print "%s -> %s" % (mod, dependencies)
def task_mod_deps():
"""task that depends on all direct imports"""
for mod in MOD_IMPORTS.iterkeys():
yield {'name': mod,
'actions': [(print_deps,(mod,))],
'file_dep': [mod],
'calc_dep': ["get_dep:%s" % mod],
}
def get_dep(mod):
# fake implementation
return {'file_dep': MOD_IMPORTS[mod]}
def task_get_dep():
"""get direct dependencies for each module"""
for mod in MOD_IMPORTS.iterkeys():
yield {'name': mod,
'actions':[(get_dep,[mod])],
'file_dep': [mod],
}
|