Please note:The SCons wiki is now restored from the attack in March 2013. All old passwords have been invalidated. Please reset your password if you have an account. If you note missing pages, please report them to webmaster@scons.org. Also, new account creation is currently disabled due to an ongoing spam flood (2013/08/27).

Analyzing source trees, based on dependency graphs

Tools

While trying to get a deeper understanding for the source of SCons, I actually wanted to see the classes and their dependencies. Googling around I found these two tools that could produce DOT graph files for class or import dependencies from Python source trees:

Commands

Having both applications installed, I called

sfood -i . | sfood-graph > scons_import.dot

pyreverse -p scons -k .

with the SCons source directory as current folder.

Unfortunately, the resulting graphs were pretty large and visualizing them via the dot tool did not help. PNG, PS or SVG output, the images got too large and the layout of the nodes and edges left a lot to desire.

dottoxml.py

Then I remembered the yEd Graph Editor (http://www.yworks.com/en/products_yed_about.html), a great application that can layout and handle even very large datasets...if you find a way to get the data inside. Since it does not import DOT files (yet), I wrote the little converter script dottoxml.py (http://www.mydarc.de/dl9obn/programming/python/dottoxml) that outputs yEd's native file format Graphml (XML).

Now looking at complicated DOT graphs is a snap...have a try!

Examples

The following files were created with the sources for SCons 1.2.0.d20090223 and Waf 1.5.8, they are all available in two versions:

  1. The nodes contain not only the class names, but also methods/attributes ("_fc" suffix) and
  2. class names only (no special suffix).

Graphml files (XML) with dependencies that can be read directly by yEd:

The original DOT files:

Screenshots

SCons classes

[ATTACH] [ATTACH]

[ATTACH]

Waf classes

[ATTACH]

[ATTACH]

SCons packages

[ATTACH]

Waf packages

[ATTACH]

VisualizeDependencies (last edited 2009-08-18 22:21:37 by DirkBaechle)