M Makefile => Makefile +6 -0
@@ 22,6 22,12 @@ bwrap_test: # Bubblewrap-based test in bare environment.
doc/data/%.dot: script/dot/%.sh
sh "$<" type_stack_calc type_stack_calc/ bin/ > "$@"
+script/dot/class_rel.py: script/dot/gen_class_rel_py.sh # Makes the python file that scans it.
+ sh $< type_stack_calc > "$@"
+
+doc/data/class_rel.dot: script/dot/class_rel.py
+ cat $< | python > $@
+
# Produce the images from the .dot files.
%.dot.png: %.dot
dot "$<" -Tpng -o "$@"
A script/dot/gen_class_rel_py.sh => script/dot/gen_class_rel_py.sh +28 -0
@@ 0,0 1,28 @@
+#!/usr/bin/bash
+
+# Generates the python that figures class connections.
+
+# TODO might be a BUG where there is overlap between names?
+# TODO probably neater if it marks what type of role the classes play.
+# * if it is introduced as usuable object.
+# * if it is introduced after processing(extraction)
+
+echo "modules = set()"
+find "$@" -type f |grep -vF /unused/ |grep -vF /mess/ | grep -vF __pycache__ | while read LINE; do
+ MODULE=$(echo $LINE | cut -f 1 -d '.' | tr '/' '.')
+ echo import $MODULE
+ echo "modules.add($MODULE)"
+done
+
+echo 'print("digraph {")
+done = set()
+for m in modules:
+ for k in dir(m):
+ got = getattr(m, k)
+ if type(got) == type:
+ for sub in got.__subclasses__():
+ pair = (got.__name__, sub.__name__)
+ if pair not in done:
+ print(got.__name__, "->", sub.__name__)
+ done.add(pair)
+print("}")'
M script/dot/module_bunches.sh => script/dot/module_bunches.sh +2 -0
@@ 1,5 1,7 @@
#!/usr/bin/bash
+# Generates dot data for bunches of modules taken together.
+
echo "digraph {"
MAINPKG="$1"
M script/dot/modules.sh => script/dot/modules.sh +2 -0
@@ 1,5 1,7 @@
#!/usr/bin/bash
+# Generates single-module graphviz .dot file.
+
# Not sure how much it means necessarily, functionality goes through methods/attributes aswel.
# For instance could access a unique attribute instead of getting the class and using `isinstance`.