Add a function to compute a dependency tree

This commit is contained in:
Iavor Diatchki 2022-12-02 13:43:32 -08:00
parent 5987dbd1e9
commit 40146551a8

View File

@ -0,0 +1,12 @@
def nestedFileDeps(getDeps, name : str, isFile : bool) -> Any:
done = {}
start = getDeps(name, isFile)
todo = start["imports"].copy()
while len(todo) > 0:
m = todo.pop()
if m in done:
continue
deps = file_deps(m, False)
todo.extend(deps["imports"])
return (start, deps)