From 04fc6c478876bd40389e4f8b754c7adfaf42621c Mon Sep 17 00:00:00 2001 From: Costa Shulyupin Date: Tue, 13 Nov 2018 22:06:40 +0200 Subject: [PATCH] +dir_tree --- srcxray.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/srcxray.py b/srcxray.py index 2353ebc..c0d0915 100755 --- a/srcxray.py +++ b/srcxray.py @@ -969,6 +969,22 @@ def import_symbols(): 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(): print("Usage:\n") for c in ["referers_tree", "call_tree", "referers_dep", "call_dep"]: