Attachment 'libtbx_config_to_dot.py'

Download

   1 import os, os.path
   2 
   3 base='cctbx_sources'
   4 dirs=os.listdir('cctbx_sources')
   5 mods=[d for d in dirs if os.path.isdir(os.path.join(base,d)) and 'libtbx_config' in os.listdir(os.path.join(base,d))]
   6 
   7 usereq={}
   8 buildreq={}
   9 optmods={}
  10 excl={}
  11 
  12 for m in mods:
  13   f=open(os.path.join(base,m,'libtbx_config'))
  14   d=eval(f.read())
  15   f.close()
  16   usereq[m]=d.get('modules_required_for_use',[])
  17   buildreq[m]=d.get('modules_required_for_build',[])
  18   optmods[m]=d.get('optional_modules',[])
  19   excl[m]=d.get('exclude_from_binary_bundle',[])
  20 
  21 copts=[m for k in optmods for m in optmods[k] if m not in mods]
  22 cusereqs=[m for k in usereq for m in usereq[k] if m not in mods]
  23 cbuildreqs=[m for k in buildreq for m in buildreq[k] if m not in mods]
  24 extmods=list(set(copts+cusereqs+cbuildreqs))
  25 
  26 import pygraphviz as pgv
  27 
  28 G=pgv.AGraph(directed=True)
  29 
  30 G.add_nodes_from(mods,shape='box',color='red')
  31 G.add_nodes_from(extmods,shape='box',color='green')
  32 
  33 G.add_edges_from([(k,m) for k in usereq for m in usereq[k]],color='black')
  34 G.add_edges_from([(k,m) for k in buildreq for m in buildreq[k]],color='red')
  35 G.add_edges_from([(k,m) for k in optmods for m in optmods[k]],color='green')
  36 
  37 G.write("cctbx-depends.dot")

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.