comparison mx/commands.py @ 5707:e149c0e252e0

generated jpg for link to svg version of dependency to accommodate Internet Explorer
author Doug Simon <doug.simon@oracle.com>
date Wed, 27 Jun 2012 18:21:49 +0200
parents 6f2ccb483d96
children 1c7852e6a39a
comparison
equal deleted inserted replaced
5706:6f2ccb483d96 5707:e149c0e252e0
1101 1101
1102 # Generate dependency graph with Graphviz 1102 # Generate dependency graph with Graphviz
1103 _, tmp = tempfile.mkstemp() 1103 _, tmp = tempfile.mkstemp()
1104 try: 1104 try:
1105 svg = join(args.base, 'all', 'modules.svg') 1105 svg = join(args.base, 'all', 'modules.svg')
1106 jpg = join(args.base, 'all', 'modules.jpg')
1106 with open(tmp, 'w') as fp: 1107 with open(tmp, 'w') as fp:
1107 print >> fp, 'digraph projects {' 1108 print >> fp, 'digraph projects {'
1108 print >> fp, 'rankdir=BT;' 1109 print >> fp, 'rankdir=BT;'
1109 print >> fp, 'size = "13,13";' 1110 print >> fp, 'size = "13,13";'
1110 print >> fp, 'node [shape=rect, fontcolor="blue"];' 1111 print >> fp, 'node [shape=rect, fontcolor="blue"];'
1111 print >> fp, 'edge [color="green"];' 1112 #print >> fp, 'edge [color="green"];'
1112 for p in mx.projects(): 1113 for p in mx.projects():
1113 print >> fp, '"' + p.name + '" [URL = "../' + p.name + '/javadoc/index.html", target = "_top"]' 1114 print >> fp, '"' + p.name + '" [URL = "../' + p.name + '/javadoc/index.html", target = "_top"]'
1114 for dep in p.canonical_deps(): 1115 for dep in p.canonical_deps():
1115 if mx.project(dep, False): 1116 if mx.project(dep, False):
1116 print >> fp, '"' + p.name + '" -> "' + dep + '"' 1117 print >> fp, '"' + p.name + '" -> "' + dep + '"'
1120 depths.setdefault(d, list()).append(p.name) 1121 depths.setdefault(d, list()).append(p.name)
1121 for d, names in depths.iteritems(): 1122 for d, names in depths.iteritems():
1122 print >> fp, '{ rank = same; "' + '"; "'.join(names) + '"; }' 1123 print >> fp, '{ rank = same; "' + '"; "'.join(names) + '"; }'
1123 print >> fp, '}' 1124 print >> fp, '}'
1124 1125
1125 mx.run(['dot', '-Tsvg', '-o' + svg, tmp]) 1126 mx.run(['dot', '-Tsvg', '-o' + svg, '-Tjpg', '-o' + jpg, tmp])
1126 1127
1127 finally: 1128 finally:
1128 os.remove(tmp) 1129 os.remove(tmp)
1129 1130
1130 # Post-process generated SVG to remove title elements which most browsers 1131 # Post-process generated SVG to remove title elements which most browsers