+dir_tree

This commit is contained in:
Costa Shulyupin 2018-11-13 22:06:40 +02:00
parent 1fbd23a069
commit 04fc6c4788
1 changed files with 16 additions and 0 deletions

View File

@ -969,6 +969,22 @@ def import_symbols():
me = os.path.basename(sys.argv[0]) me = os.path.basename(sys.argv[0])
def dir_tree(d='.'):
stack = list()
nprev = -1
g = my_graph()
# all = nx.DiGraph()
# TODO
for path, dirs, files, fds in os.fwalk(d):
print(path, fds)
(dir, base) = os.path.split(path)
path2 = path.split(os.sep)
if len(path2) > 1:
# g.add_edge(path2[-2] + str(), path2[-1])
g.add_edge(dir, path)
return g
def usage(): def usage():
print("Usage:\n") print("Usage:\n")
for c in ["referers_tree", "call_tree", "referers_dep", "call_dep"]: for c in ["referers_tree", "call_tree", "referers_dep", "call_dep"]: