graphvizplugin/0000755000175000017500000000000011243003353012255 5ustar wmbwmbgraphvizplugin/0.11-0.7.5/0000755000175000017500000000000011243003353013301 5ustar wmbwmbgraphvizplugin/0.11-0.7.5/build.sh0000755000175000017500000000074210767610634014762 0ustar wmbwmb#! /bin/sh echo $PATH ENV=/opt/trac/py25/env0.11 PORT=9011 export PATH=$ENV/bin:$PATH_RESET echo "cleaning out old build" rm -rf build dist python setup.py bdist_egg echo "cleaning out old installation" rm -f $ENV/trac/plugins/graphviz-*.egg rm -f $ENV/trac/htdocs/graphviz/* echo "running tracd on port $PORT" cp dist/graphviz-*.egg $ENV/trac/plugins/ #LD_LIBRARY_PATH=$ENV/lib tracd --port $PORT -b 172.16.6.1 $ENV/trac LD_LIBRARY_PATH=$ENV/lib tracd --port $PORT $ENV/trac graphvizplugin/0.11-0.7.5/examples/0000755000175000017500000000000011243003353015117 5ustar wmbwmbgraphvizplugin/0.11-0.7.5/examples/GraphvizExamples%2FJustTestingGraphviz0000444000175000017500000000040710350162514024511 0ustar wmbwmb{{{ #!graphviz.circo digraph G { Hello->World Hello->Goodbye World->Graphviz Graphviz->Rules Hello->Mary Hello->Peter Peter->Loves Loves->Mary Mary->Loves Loves->Peter Loves->Rio Loves->Mocha } }}} graphvizplugin/0.11-0.7.5/examples/GraphvizExamples%2FInvokingCirco0000444000175000017500000000024110350162514023253 0ustar wmbwmb= Graphviz Example Invoking Circo = {{{ #!graphviz.circo digraph G { Hello->World Hello->Goodbye World->Graphviz Graphviz->Rules } }}} graphvizplugin/0.11-0.7.5/examples/GraphvizExamples%2FGraphvizExample30000444000175000017500000000070010350162514023700 0ustar wmbwmb{{{ #!graphviz digraph G { subgraph cluster_0 { style=filled; color=lightgrey; node [style=filled,color=white]; a0 -> a1 -> a2 -> a3; label = "process #1"; } subgraph cluster_1 { node [style=filled]; b0 -> b1 -> b2 -> b3; label = "process #2"; color=blue } start -> a0; start -> b0; a1 -> b3; b2 -> a3; a3 -> a0; a3 -> end; b3 -> end; start [shape=Mdiamond]; end [shape=Msquare]; } }}}graphvizplugin/0.11-0.7.5/examples/GraphvizExamples%2FInvokingDot0000444000175000017500000000023510350162514022745 0ustar wmbwmb= Graphviz Example Invoking Dot = {{{ #!graphviz.dot digraph G { Hello->World Hello->Goodbye World->Graphviz Graphviz->Rules } }}} graphvizplugin/0.11-0.7.5/examples/GraphvizExamples%2FInvokingNeato0000444000175000017500000000024110350162514023262 0ustar wmbwmb= Graphviz Example Invoking Neato = {{{ #!graphviz.neato digraph G { Hello->World Hello->Goodbye World->Graphviz Graphviz->Rules } }}} graphvizplugin/0.11-0.7.5/examples/GraphvizExamples%2FOutputJpg0000444000175000017500000000075210350162514022457 0ustar wmbwmb= Graphviz Example Output Jpg = {{{ #!graphviz.dot/jpg digraph G { subgraph cluster_0 { style=filled; color=lightgrey; node [style=filled,color=white]; a0 -> a1 -> a2 -> a3; label = "process #1"; } subgraph cluster_1 { node [style=filled]; b0 -> b1 -> b2 -> b3; label = "process #2"; color=red } start -> a0; start -> b0; a1 -> b3; b2 -> a3; a3 -> a0; a3 -> end; b3 -> end; start [shape=Mdiamond]; end [shape=Msquare]; } }}} graphvizplugin/0.11-0.7.5/examples/GraphvizExamples%2FWikiLinksSvg0000444000175000017500000000204010350627420023074 0ustar wmbwmb= Graphviz Example Wiki Links, SVG Image = The links in the diagram use Trac wiki links to point to various places: * '''Ticket 1''' points to ticket:1 * '''Report 1''' points to report:1 * '''Changeset 1''' points to changeset:1 * '''Graphviz Examples''' points to wiki:GraphvizExamples * '''Milestone 1''' points to milestone:milestone1 * '''Source Link''' points to source:Readme.txt {{{ #!graphviz.circo/svg digraph G { "Ticket 1" [style=filled, fillcolor=white, URL="ticket:1"]; "Report 1" [style=filled, fillcolor=white, URL="report:1"]; "Changeset 1" [style=filled, fillcolor=white, URL="changeset:1"]; "Graphviz Examples" [style=filled, fillcolor=white, URL="wiki:GraphvizExamples"]; "Milestone 1" [style=filled, fillcolor=white, URL="milestone:milestone1"]; "Readme.txt" [style=filled, fillcolor=white, URL="source:Readme.txt"]; "Ticket 1"; "Report 1"; "Changeset 1"; "Graphviz Examples"; "Milestone 1"; "Readme.txt"; } }}} graphvizplugin/0.11-0.7.5/examples/GraphvizExamples%2FOutputGif0000444000175000017500000000075210350162514022444 0ustar wmbwmb= Graphviz Example Output Gif = {{{ #!graphviz.dot/gif digraph G { subgraph cluster_0 { style=filled; color=lightgrey; node [style=filled,color=white]; a0 -> a1 -> a2 -> a3; label = "process #1"; } subgraph cluster_1 { node [style=filled]; b0 -> b1 -> b2 -> b3; label = "process #2"; color=red } start -> a0; start -> b0; a1 -> b3; b2 -> a3; a3 -> a0; a3 -> end; b3 -> end; start [shape=Mdiamond]; end [shape=Msquare]; } }}} graphvizplugin/0.11-0.7.5/examples/GraphvizExamples%2FGraphvizExample20000444000175000017500000000332210350162514023702 0ustar wmbwmb{{{ #!graphviz digraph g { graph [ rankdir = "LR" ]; node [ fontsize = "16" shape = "ellipse" ]; edge [ ]; "node0" [ label = " 0x10ba8| " shape = "record" ]; "node1" [ label = " 0xf7fc4380| | |-1" shape = "record" ]; "node2" [ label = " 0xf7fc44b8| | |2" shape = "record" ]; "node3" [ label = " 3.43322790286038071e-06|44.79998779296875|0" shape = "record" ]; "node4" [ label = " 0xf7fc4380| | |2" shape = "record" ]; "node5" [ label = " (nil)| | |-1" shape = "record" ]; "node6" [ label = " 0xf7fc4380| | |1" shape = "record" ]; "node7" [ label = " 0xf7fc4380| | |2" shape = "record" ]; "node8" [ label = " (nil)| | |-1" shape = "record" ]; "node9" [ label = " (nil)| | |-1" shape = "record" ]; "node10" [ label = " (nil)| | |-1" shape = "record" ]; "node11" [ label = " (nil)| | |-1" shape = "record" ]; "node12" [ label = " 0xf7fc43e0| | |1" shape = "record" ]; "node0":f0 -> "node1":f0 [ id = 0 ]; "node0":f1 -> "node2":f0 [ id = 1 ]; "node1":f0 -> "node3":f0 [ id = 2 ]; "node1":f1 -> "node4":f0 [ id = 3 ]; "node1":f2 -> "node5":f0 [ id = 4 ]; "node4":f0 -> "node3":f0 [ id = 5 ]; "node4":f1 -> "node6":f0 [ id = 6 ]; "node4":f2 -> "node10":f0 [ id = 7 ]; "node6":f0 -> "node3":f0 [ id = 8 ]; "node6":f1 -> "node7":f0 [ id = 9 ]; "node6":f2 -> "node9":f0 [ id = 10 ]; "node7":f0 -> "node3":f0 [ id = 11 ]; "node7":f1 -> "node1":f0 [ id = 12 ]; "node7":f2 -> "node8":f0 [ id = 13 ]; "node10":f1 -> "node11":f0 [ id = 14 ]; "node10":f2 -> "node12":f0 [ id = 15 ]; "node11":f2 -> "node1":f0 [ id = 16 ]; } }}} graphvizplugin/0.11-0.7.5/examples/GraphvizExamples%2FOutputPng0000444000175000017500000000075210350162514022463 0ustar wmbwmb= Graphviz Example Output Png = {{{ #!graphviz.dot/png digraph G { subgraph cluster_0 { style=filled; color=lightgrey; node [style=filled,color=white]; a0 -> a1 -> a2 -> a3; label = "process #1"; } subgraph cluster_1 { node [style=filled]; b0 -> b1 -> b2 -> b3; label = "process #2"; color=red } start -> a0; start -> b0; a1 -> b3; b2 -> a3; a3 -> a0; a3 -> end; b3 -> end; start [shape=Mdiamond]; end [shape=Msquare]; } }}} graphvizplugin/0.11-0.7.5/examples/load_examples.py0000444000175000017500000000146511072425556020327 0ustar wmbwmb#! /usr/bin/env python import sys import os from trac.admin.console import TracAdmin def main(trac_env, examples_dir='.'): loaded = False admin = TracAdmin() admin.env_set(trac_env) for file in os.listdir(examples_dir): if 'GraphvizExamples' in file: admin._do_wiki_import(os.path.join(examples_dir, file), file.replace('%2F', '/')) loaded = True if not loaded: print 'The %(examples_dir)s does not contain any GrapgvizExamples files.' % locals() if __name__ == '__main__': argv_len = len(sys.argv) if argv_len == 2: main(sys.argv[1]) elif argv_len == 3: main(sys.argv[1], sys.argv[2]) else: print 'usage: load_examples.py trac_env_path [examples_directory]' sys.exit(1) graphvizplugin/0.11-0.7.5/examples/GraphvizExamples0000444000175000017500000000152710350627420020343 0ustar wmbwmb= Graphviz Examples = == Just the basics == Invoking [wiki:GraphvizExamples/InvokingDot dot], [wiki:GraphvizExamples/InvokingNeato neato], [wiki:GraphvizExamples/InvokingTwopi twopi], [wiki:GraphvizExamples/InvokingCirco circo] and [wiki:GraphvizExamples/InvokingFdp fdp] with the same graph description. == Output Formats == Setting the output format to [wiki:GraphvizExamples/OutputPng png], [wiki:GraphvizExamples/OutputJpg jpg], [wiki:GraphvizExamples/OutputGif gif] and [wiki:GraphvizExamples/OutputSvg svg]. == Image Maps == Using client side image maps to [wiki:GraphvizExamples/MapWhole map whole image], [wiki:GraphvizExamples/MapNodesPng map nodes (png)], [wiki:GraphvizExamples/MapNodesSvg map nodes (svg)], [wiki:GraphvizExamples/WikiLinksPng wiki links (png)], and [wiki:GraphvizExamples/WikiLinksSvg wiki links (svg)]. graphvizplugin/0.11-0.7.5/examples/GraphvizExamples%2FMapWhole0000444000175000017500000000054210350162514022227 0ustar wmbwmb= Graphviz Example Map Whole Image = The '''TracProject''' portion points to the Trac project page at Edgewall while the rest of the image points to the Edgewall site. {{{ #!graphviz digraph G { URL="http://www.edgewall.com/"; label = "Edgewall" TracProject [URL="http://projects.edgewall.com/trac/"]; TracProject; } }}} graphvizplugin/0.11-0.7.5/examples/GraphvizExamples%2FMapNodesPng0000444000175000017500000000203310350627420022665 0ustar wmbwmb= Graphviz Eamples Map Nodes, PNG Image = The individual nodes of the image point to the various pages on the Edgewall Trac project site. {{{ #!graphviz.circo/png digraph G { Trac [URL="http://trac.edgewall.com/"]; TracProject [URL="http://projects.edgewall.com/trac/"]; Guide [URL="http://projects.edgewall.com/trac/wiki/TracGuide"]; FAQ [URL="http://projects.edgewall.com/trac/wiki/TracFaq"]; Download [URL="http://projects.edgewall.com/trac/wiki/TracDownload"]; ChangeLog [URL="http://projects.edgewall.com/trac/wiki/ChangeLog"]; MailingList [URL="http://projects.edgewall.com/trac/wiki/MailingList"]; TracProject [URL="http://projects.edgewall.com/trac/wiki/TracProject"]; RoadMap [URL="http://projects.edgewall.com/trac/wiki/RoadMap"]; Team [URL="http://projects.edgewall.com/trac/wiki/TracTeam"]; Trac -> TracProject; Trac -> Guide; Trac -> FAQ; Trac -> Download; Trac -> ChangeLog; Trac -> MailingList; Trac -> RoadMap; Trac -> Team; } }}} graphvizplugin/0.11-0.7.5/examples/GraphvizExamples%2FMapNodesSvg0000444000175000017500000000246010350627420022704 0ustar wmbwmb= Graphviz Eamples Map Nodes, SVG Image = The individual nodes of the image point to the various pages on the Edgewall Trac project site. Notice that the entire oval for the Trac node is an active link while the others are only active on the text and the oval outline. The use of the '''style=filled''' and '''fillcolor=red''' force the SVG links to be activated for the whole node. {{{ #!graphviz.circo/svg digraph G { Trac [style=filled, fillcolor=red, URL="http://trac.edgewall.com/"]; TracProject [URL="http://projects.edgewall.com/trac/"]; Guide [URL="http://projects.edgewall.com/trac/wiki/TracGuide"]; FAQ [URL="http://projects.edgewall.com/trac/wiki/TracFaq"]; Download [URL="http://projects.edgewall.com/trac/wiki/TracDownload"]; ChangeLog [URL="http://projects.edgewall.com/trac/wiki/ChangeLog"]; MailingList [URL="http://projects.edgewall.com/trac/wiki/MailingList"]; TracProject [URL="http://projects.edgewall.com/trac/wiki/TracProject"]; RoadMap [URL="http://projects.edgewall.com/trac/wiki/RoadMap"]; Team [URL="http://projects.edgewall.com/trac/wiki/TracTeam"]; Trac -> TracProject; Trac -> Guide; Trac -> FAQ; Trac -> Download; Trac -> ChangeLog; Trac -> MailingList; Trac -> RoadMap; Trac -> Team; } }}} graphvizplugin/0.11-0.7.5/examples/GraphvizExamples%2FInvokingTwopi0000444000175000017500000000024110350162514023316 0ustar wmbwmb= Graphviz Example Invoking Twopi = {{{ #!graphviz.twopi digraph G { Hello->World Hello->Goodbye World->Graphviz Graphviz->Rules } }}} graphvizplugin/0.11-0.7.5/examples/GraphvizExamples%2FWikiLinksPng0000444000175000017500000000203710350627420023067 0ustar wmbwmb= Graphviz Example Wiki Links, PNG Image = The links in the diagram use Trac wiki links to point to various places: * '''Ticket 1''' points to ticket:1 * '''Report 1''' points to report:1 * '''Changeset 1''' points to changeset:1 * '''Graphviz Examples''' points to wiki:GraphvizExamples * '''Milestone 1''' points to milestone:milestone1 * '''Source Link''' points to source:Readme.txt {{{ #!graphviz.circo/png digraph G { "Ticket 1" [style=filled, fillcolor=white, URL="ticket:1"]; "Report 1" [style=filled, fillcolor=white, URL="report:1"]; "Changeset 1" [style=filled, fillcolor=white, URL="changeset:1"]; "Graphviz Examples" [style=filled, fillcolor=white, URL="wiki:GraphvizExamples"]; "Milestone 1" [style=filled, fillcolor=white, URL="milestone:milestone1"]; "Readme.txt" [style=filled, fillcolor=white, URL="source:Readme.txt"]; "Ticket 1"; "Report 1"; "Changeset 1"; "Graphviz Examples"; "Milestone 1"; "Readme.txt"; } }}} graphvizplugin/0.11-0.7.5/examples/GraphvizExamples%2FInvokingFdp0000444000175000017500000000023510350162514022730 0ustar wmbwmb= Graphviz Example Invoking Fdp = {{{ #!graphviz.fdp digraph G { Hello->World Hello->Goodbye World->Graphviz Graphviz->Rules } }}} graphvizplugin/0.11-0.7.5/examples/GraphvizExamples%2FOutputSvg0000444000175000017500000000075210350162514022476 0ustar wmbwmb= Graphviz Example Output Svg = {{{ #!graphviz.dot/svg digraph G { subgraph cluster_0 { style=filled; color=lightgrey; node [style=filled,color=white]; a0 -> a1 -> a2 -> a3; label = "process #1"; } subgraph cluster_1 { node [style=filled]; b0 -> b1 -> b2 -> b3; label = "process #2"; color=red } start -> a0; start -> b0; a1 -> b3; b2 -> a3; a3 -> a0; a3 -> end; b3 -> end; start [shape=Mdiamond]; end [shape=Msquare]; } }}} graphvizplugin/0.11-0.7.5/setup.py0000755000175000017500000000466111213377740015040 0ustar wmbwmb""" $Id$ $HeadURL$ Copyright (c) 2005, 2006, 2008 Peter Kropf. All rights reserved. Python egg setup file for the graphviz trac wiki processor. """ __revision__ = '$LastChangedRevision$' __id__ = '$Id$' __headurl__ = '$HeadURL$' __docformat__ = 'restructuredtext' __version__ = '0.7.5' from setuptools import setup, find_packages setup ( name = 'graphviz', version = __version__, packages = find_packages(), package_data = { 'graphviz' : ['examples/*',], }, entry_points={'trac.plugins': 'graphviz = graphviz'}, author = "Peter Kropf", author_email = "pkropf@gmail.com", keywords = "trac graphviz", url = "http://trac-hacks.org/wiki/GraphvizPlugin", description = "Graphviz plugin for Trac 0.11", long_description = """ The graphviz wiki processor is a plugin for Trac that allows the dynamic generation of diagrams by the various graphviz programs. The text of a wiki page can contain the source text for graphviz and the web browser will show the resulting image.""", license = """Copyright (C) 2005, 2006, 2008 Peter Kropf All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.""", ) graphvizplugin/0.11-0.7.5/ReleaseNotes.txt0000444000175000017500000002364310770005724016451 0ustar wmbwmbTrac Graphviz Plugin v0.7.1 Release Notes ========================================= March 18, 2008 Graphviz plugin v0.7.1 for Trac is now available. The v0.7.x series provides support for Trac 0.11. The Graphviz wiki processor is a plugin for Trac that allows the the dynamic generation of diagrams by the various graphviz programs. The text of a wiki page can contain the source text for graphviz and the web browser will show the resulting image. Changes for release v0.7.1 -------------------------- * Changed the interfaces used to communicate w/ Trac to support Trac 0.11. * Replaced the use of os.popen3 with subprocess.Popen to better support running on Windows. This implies that the Graphviz plugin requires Python 2.4 and above. * Renamed GraphvizMacro to Graphviz. * Added support for OS X when searching for the Graphviz executable programs. Fixes #1999. * Expanded the default locations used when searching for the Graphviz executable programs. Changes for release v0.7.0 -------------------------- * Internal release. Changes for release v0.6.8 -------------------------- * Added better support for non-ascii characters in graphviz wiki documents. Changes for release v0.6.7 -------------------------- * The GraphvizMacro v0.6.5 release introduced a bug with the now optional cmd_path. If run on a platform whose sys.platform name is not in the GraphvizMacro.cmd_paths dictionary, the self.cmd_path variable isn't initialized. This caused a wee problem and stack trace in Trac. Changes for release v0.6.6 -------------------------- * The GraphvizMacro v0.6.5 release introduced a bug with the IHTMLPreviewRenderer interface. The render method assumed that the content parameter was an object with a read method. Under trac 0.10 with a Subversion repository, this object is a svn.core.Stream. Under trac 0.9 the object is a string with the contents from the repository. As a result, the v0.6.5 wouldn't render the images and the raw text was displayed. Changes for release v0.6.5 -------------------------- * The default graphviz processor is now the only processor that must be found on the system. GraphvizMacro will not work without it. If any of the other processors are missing, a warning message will be sent to the trac log, the processor will be removed from the list of known GraphvizMacro processors and GraphvizMacro will continue. Resolves issue http://trac-hacks.org/ticket/159. * The cmd_path configuration parameter in trac.ini is now optional. Reasonable default values have been set for Linux, Win32 and FreeBSD6. * Altered the way the GraphvizMacro description is returned in get_macro_description. Instead of returning a description for each variant (graphviz, graphviz/png, graphviz/svg, etc.) only return a description for graphviz. This will cleanup the WikiMacros page a bit to hopefully make it easier to navigate. It isn't a perfect solution since all the graphviz macro names are still displayed but it no longer repeats the same description for each permutation. Resolves issue http://trac-hacks.org/ticket/284. * Implemented the IRequestHandler interface to return graphviz generated images. This means that graphviz images can be referenced via http://URL_TO_TRAC_SERVER/graphviz/HASH_KEY. As a result of this change, the prefix_url configuration parameter is no longer needed in the trac.ini file. Resolves issue http://trac-hacks.org/ticket/86. * Links within images that are rendered as SVG are now automatically prefixed with javascript:window.parent.location.href= to force the link to be displayed in the parent window instead of the SVG object window. Resolves issue http://trac-hacks.org/ticket/560. * Included the processor options when calculating the sha key used for the image file name. This should help in testing various graphviz settings in trac.ini. Resolves issue http://trac-hacks.org/ticket/575. * Fixed expand_wiki_links to allow for javascript URL references. Resolves issue http://trac-hacks.org/ticket/559. * GraphvizMacro is now also an IHTMLPreviewRenderer. This was done by adding application/graphviz as the mimetype for files with the extension of .graphviz, .dot, .neato, .twopi, .circo and .fdp. When browsing the source code in the respoitory, any files with those extensions will be treated as graphviz programs and will be rendered via the GraphvizMacro. Resolves issue http://trac-hacks.org/attachment/ticket/576. * Escaped the error message before displaying it. Resolves issue http://trac-hacks.org/ticket/574. Changes for release v0.6.4 -------------------------- * Fixed problem where boolean values in the trac.ini file for Graphviz would always evaluate to True. Resolves issue http://trac-hacks.org/ticket/373. Changes for release v0.6.3 -------------------------- * Corrected Trac 0.10 specific config API calls to allow the plugin to work with 0.9 as well as 0.10 releases of Trac. Changes for release v0.6.2 -------------------------- * Simplify the code to read the configuration files. Instead of having lots of if structures, default values are passed as a parameter to the self.config.get call. * Renamed Readme.txt to README.txt. * Added a additional comment to README.txt about rsvg not being available on Windows. * Changed plugin structure to use entry_points in setup.py instead of graphviz.egg-info/trac_plugin.txt. * Removed graphviz.egg-info from svn repository. It is generated via "python setup.py bdist_egg" and shouldn't be in the repository. * Added Windows trac.ini [graphviz] example. * Fixed access to global vs local config variables. Resolves issue http://trac-hacks.org/ticket/242. Changes for release v0.6.1 -------------------------- * Applied patch from eblot to correct the regular expression for embedded URLs. Resolves issue http://trac-hacks.org/ticket/161. * Renamed module variable __version__ to __revision__ to better reflect the intent. * Moved the release version number from setup.py to graphviz/graphviz.py. The version number is now logged when the graphviz module is initialized. * Commented out the many self.log.debug messages. As pointed out in, http://trac-hacks.org/ticket/238, the core seems to be mostly stable and having lots and lots of debugging messages may no longer be needed. * Added defaults for the cache management control values: * cache_max_size = 10,000,000 * cache_min_size = 5,000,000 * cache_max_count = 2,000 * cache_min_count = 1,500 The resolves issue http://trac-hacks.org/ticket/160. Changes for release v0.6 ------------------------ * In render_macro, corrected the self.log.debug statements that were printing out the req.args and req.base_url. They are not always available. Removed the reference to req.base_url since it was not being used and may not always be an attribute to req. Resolves issue http://trac-hacks.org/ticket/193. * Added import for the inspect module. Resolves issue http://trac-hacks.org/ticket/236. Changes for release v0.5.1 -------------------------- * Corrected typo in graphviz.py where the wrong internal variable was being used to display an error message. Changes for release v0.5 ------------------------ * Added a note in the Readme.txt wrt using load_examples.py to import the Graphviz examples into a wiki. Fixed load_examples.py so that it correctly looks for Graphviz examples in directories other than the working directory. * Fixed a bug whereby image maps were a bit off when using the png antialiasing option. * URL= strings in diagrams can now have Trac wiki links like ticket:1, report:7, changeset:47, wiki:CamelCasePage, milestone:milestone1 and source:Readme.txt. * Added additional examples for links in SVG images and using Trac wiki links. * Fixed the bug #102 (http://trac-hacks.swapoff.org/ticket/102) whereby popen2.Popen3 is not available on Windows. Changes for release v0.4 ------------------------ * Map support for bitmap images, allowing to use URL="" attributes in graphs. Maps are only generated if the URL= string is found in the Graphviz diagram. * Antialiasing on PNG images, using rsvg, from . * Better display of SVG images and IE support. * Display errors graphviz may produce. * Support for global graph options. * Updated documentation. * Example graphs have been created to outline the basic capabilities of the plugin. * The tmp_dir is no longer needed. Instead of creating temp files to be processed by graphviz, the plugin now communicates with the graphviz programs through pipes. * Expanded info and debugging messages to allow for better debugging of the running environment. * Error messages that occur when running the grapviz programs will now be displayed in the browser. This should help in resolving syntax problems with graphviz code. * Graphviz program paths are now enclosed in quotes. This should resolve the problem when there are spaces in the path as is typical on Windows. Changes for release v0.3 ------------------------ * A simple cache manager has been added to keep the cache disk space and directory entry count under control. A series of parameters in the [graphviz] section of the trac.ini configuration file are used to control the cache manager. * The tmp files used in processing the graphviz language are now deleted after the new image is created. * A series of debugging statements are now in the code. See the Trac logging documentation section for details on how logging works. More Information ---------------- The graphviz plugin macro home page can be found at: https://trac-hacks.swapoff.org/wiki/GraphvizPlugin The plugin has been tested on a Linux x86 system running python 2.4 and the latest version of trac from subversion. Testing on other platforms would be appreciated. Bugs and enhancement requests can be submitted at: http://trac-hacks.swapoff.org/newticket?component=GraphvizPlugin&owner=pkropf $Id$ graphvizplugin/0.11-0.7.5/COPYING0000444000175000017500000000260310532142026014334 0ustar wmbwmbCopyright (C) 2005,2006 Peter Kropf All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. graphvizplugin/0.11-0.7.5/graphviz/0000755000175000017500000000000011243003353015133 5ustar wmbwmbgraphvizplugin/0.11-0.7.5/graphviz/__init__.py0000444000175000017500000000043710532145422017252 0ustar wmbwmb""" $Id$ $HeadURL$ Copyright (c) 2005, 2006 Peter Kropf. All rights reserved. Module file for the graphviz trac wiki processor. """ __revision__ = '$LastChangedRevision$' __id__ = '$Id$' __headurl__ = '$HeadURL$' __docformat__ = 'restructuredtext' from graphviz import * graphvizplugin/0.11-0.7.5/graphviz/graphviz.py0000444000175000017500000006070211210173304017340 0ustar wmbwmb""" $Id$ $HeadURL$ Copyright (c) 2005, 2006, 2008 Peter Kropf. All rights reserved. Module documentation goes here. """ __revision__ = '$LastChangedRevision$' __id__ = '$Id$' __headurl__ = '$HeadURL$' __docformat__ = 'restructuredtext' __version__ = '0.7.5dev' import inspect import locale import os import re import sha import subprocess import sys from genshi.builder import Element, tag from genshi.core import Markup from trac.config import BoolOption, IntOption, Option from trac.core import * from trac.mimeview.api import Context, IHTMLPreviewRenderer, MIME_MAP from trac.util import escape from trac.util.text import to_unicode from trac.util.translation import _ from trac.web.api import IRequestHandler from trac.wiki.api import IWikiMacroProvider from trac.wiki.formatter import extract_link class Graphviz(Component): """ Graphviz (http://trac-hacks.org/wiki/GraphvizPlugin) provides a plugin for Trac to render graphviz (http://www.graphviz.org/) drawings within a Trac wiki page. """ implements(IWikiMacroProvider, IHTMLPreviewRenderer, IRequestHandler) # Available formats and processors, default first (dot/png) Processors = ['dot', 'neato', 'twopi', 'circo', 'fdp'] Bitmap_Formats = ['png', 'jpg', 'gif'] Vector_Formats = ['svg', 'svgz'] Formats = Bitmap_Formats + Vector_Formats Cmd_Paths = { 'linux2': ['/usr/bin', '/usr/local/bin',], 'win32': ['c:\\Program Files\\Graphviz\\bin', 'c:\\Program Files\\ATT\\Graphviz\\bin', ], 'freebsd6': ['/usr/local/bin', ], 'freebsd5': ['/usr/local/bin', ], 'darwin': ['/opt/local/bin', '/sw/bin',], } # Note: the following options named "..._option" are those which need # some additional processing, see `_load_config()` below. DEFAULT_CACHE_DIR = 'gvcache' cache_dir_option = Option("graphviz", "cache_dir", DEFAULT_CACHE_DIR, """The directory that will be used to cache the generated images. Note that if different than the default (`%s`), this directory must exist. If not given as an absolute path, the path will be relative to the Trac environment's directory. """ % DEFAULT_CACHE_DIR) encoding = Option("graphviz", "encoding", 'utf-8', """The encoding which should be used for communicating with Graphviz (should match `-Gcharset` if given). """) cmd_path = Option("graphviz", "cmd_path", '', r"""Full path to the directory where the graphviz programs are located. If not specified, the default is `/usr/bin` on Linux, `C:\Program Files\ATT\Graphviz\bin` on Windows and `/usr/local/bin` on FreeBSD 6. """) out_format = Option("graphviz", "out_format", Formats[0], """Graph output format. Valid formats are: png, jpg, svg, svgz, gif. If not specified, the default is png. This setting can be overrided on a per-graph basis. """) processor = Option("graphviz", "processor", Processors[0], """Graphviz default processor. Valid processors are: dot, neato, twopi, fdp, circo. If not specified, the default is dot. This setting can be overrided on a per-graph basis. !GraphvizMacro will verify that the default processor is installed and will not work if it is missing. All other processors are optional. If any of the other processors are missing, a warning message will be sent to the trac log and !GraphvizMacro will continue to work. """) png_anti_alias = BoolOption("graphviz", "png_antialias", False, """If this entry exists in the configuration file, then PNG outputs will be antialiased. Note that this requires `rsvg` to be installed. """) rsvg_path_option = Option("graphviz", "rsvg_path", "", """Full path to the rsvg program (including the filename). The default is `/rsvg`. """) cache_manager = BoolOption("graphviz", "cache_manager", False, """If this entry exists and set to true in the configuration file, then the cache management logic will be invoked and the cache_max_size, cache_min_size, cache_max_count and cache_min_count must be defined. """) cache_max_size = IntOption("graphviz", "cache_max_size", 1024*1024*10, """The maximum size in bytes that the cache should consume. This is the high watermark for disk space used. """) cache_min_size = IntOption("graphviz", "cache_min_size", 1024*1024*5, """When cleaning out the cache, remove files until this size in bytes is used by the cache. This is the low watermark for disk space used. """) cache_max_count = IntOption("graphviz", "cache_max_count", 2000, """The maximum number of files that the cache should contain. This is the high watermark for the directory entry count. """) cache_min_count = IntOption("graphviz", "cache_min_count", 1500, """The minimum number of files that the cache should contain. This is the low watermark for the directory entry count. """) dpi = IntOption('graphviz', 'default_graph_dpi', 96, """Default dpi setting for graphviz, used during SVG to PNG rasterization. """) def __init__(self): self.log.info('version: %s - id: %s' % (__version__, str(__id__))) #self.log.info('processors: %s' % str(Graphviz.Processors)) #self.log.info('formats: %s' % str(Graphviz.Formats)) # IHTMLPreviewRenderer methods MIME_TYPES = ('application/graphviz') def get_quality_ratio(self, mimetype): if mimetype in self.MIME_TYPES: return 2 return 0 def render(self, context, mimetype, content, filename=None, url=None): ext = filename.split('.')[1] name = ext == 'graphviz' and 'graphviz' or 'graphviz.%s' % ext text = hasattr(content, 'read') and content.read() or content return self.expand_macro(context, name, text) # IRequestHandler methods def match_request(self, req): return req.path_info.startswith('/graphviz') def process_request(self, req): # check and load the configuration errmsg = self._load_config() if errmsg: return self._error_div(errmsg) pieces = [item for item in req.path_info.split('/graphviz') if item] if pieces: pieces = [item for item in pieces[0].split('/') if item] if pieces: name = pieces[0] img_path = os.path.join(self.cache_dir, name) return req.send_file(img_path) # IWikiMacroProvider methods def get_macros(self): """Return an iterable that provides the names of the provided macros.""" self._load_config() for p in ['.' + p for p in Graphviz.Processors] + ['']: for f in ['/' + f for f in Graphviz.Formats] + ['']: yield 'graphviz%s%s' % (p, f) def get_macro_description(self, name): """ Return a plain text description of the macro with the specified name. Only return a description for the base graphviz macro. All the other variants (graphviz/png, graphviz/svg, etc.) will have no description. This will cleanup the WikiMacros page a bit. """ if name == 'graphviz': return inspect.getdoc(Graphviz) else: return None def expand_macro(self, formatter_or_context, name, content): """Return the HTML output of the macro. :param formatter_or_context: a Formatter when called as a macro, a Context when called by `GraphvizPlugin.render` :param name: Wiki macro command that resulted in this method being called. In this case, it should be 'graphviz', followed (or not) by the processor name, then by an output format, as following: graphviz./ Valid processor names are: dot, neato, twopi, circo, and fdp. The default is dot. Valid output formats are: jpg, png, gif, svg and svgz. The default is the value specified in the out_format configuration parameter. If out_format is not specified in the configuration, then the default is png. examples: graphviz.dot/png -> dot png graphviz.neato/jpg -> neato jpg graphviz.circo -> circo png graphviz/svg -> dot svg :param content: The text the user entered for the macro to process. """ # check and load the configuration errmsg = self._load_config() if errmsg: return self._error_div(errmsg) ## Extract processor and format from name processor = out_format = None # first try with the RegExp engine try: m = re.match('graphviz\.?([a-z]*)\/?([a-z]*)', name) (processor, out_format) = m.group(1, 2) # or use the string.split method except: (d_sp, s_sp) = (name.split('.'), name.split('/')) if len(d_sp) > 1: s_sp = d_sp[1].split('/') if len(s_sp) > 1: out_format = s_sp[1] processor = s_sp[0] elif len(s_sp) > 1: out_format = s_sp[1] # assign default values, if instance ones are empty if not out_format: out_format = self.out_format if not processor: processor = self.processor if processor in Graphviz.Processors: proc_cmd = self.cmds[processor] else: self.log.error('render_macro: requested processor (%s) not found.' % processor) return self._error_div('requested processor (%s) not found.' % processor) if out_format not in Graphviz.Formats: self.log.error('render_macro: requested format (%s) not found.' % out_format) return self._error_div( tag.p(_("Graphviz macro processor error: " "requested format (%(fmt)s) not valid.", fmt=out_format))) encoded_cmd = (processor + unicode(self.processor_options)) \ .encode(self.encoding) encoded_content = content.encode(self.encoding) sha_key = sha.new(encoded_cmd + encoded_content).hexdigest() img_name = '%s.%s.%s' % (sha_key, processor, out_format) # cache: hash.. img_path = os.path.join(self.cache_dir, img_name) map_name = '%s.%s.map' % (sha_key, processor) # cache: hash..map map_path = os.path.join(self.cache_dir, map_name) # Check for URL="" presence in graph code URL_in_graph = 'URL=' in content # Create image if not in cache if not os.path.exists(img_path): self._clean_cache() if URL_in_graph: # translate wiki TracLinks in URL if isinstance(formatter_or_context, Context): context = formatter_or_context else: context = formatter_or_context.context content = self._expand_wiki_links(context, out_format, content) encoded_content = content.encode(self.encoding) # Antialias PNGs with rsvg, if requested if out_format == 'png' and self.png_anti_alias == True: # 1. SVG output failure, errmsg = self._launch( encoded_content, proc_cmd, '-Tsvg', '-o%s.svg' % img_path, *self.processor_options) if failure: return self._error_div(errmsg) # 2. SVG to PNG rasterization failure, errmsg = self._launch( None, self.rsvg_path, '--dpi-x=%d' % self.dpi, '--dpi-y=%d' % self.dpi, '%s.svg' % img_path, img_path) if failure: return self._error_div(errmsg) else: # Render other image formats failure, errmsg = self._launch( encoded_content, proc_cmd, '-T%s' % out_format, '-o%s' % img_path, *self.processor_options) if failure: return self._error_div(errmsg) # Generate a map file for binary formats if URL_in_graph and out_format in Graphviz.Bitmap_Formats: # Create the map if not in cache if not os.path.exists(map_path): failure, errmsg = self._launch( encoded_content, proc_cmd, '-Tcmap', '-o%s' % map_path, *self.processor_options) if failure: return self._error_div(errmsg) if errmsg: # there was a warning. Ideally we should be able to use # `add_warning` here, but that's not possible as the warnings # are already emitted at this point in the template processing return self._error_div(errmsg) # Generate HTML output img_url = formatter_or_context.href.graphviz(img_name) # for SVG(z) if out_format in Graphviz.Vector_Formats: try: # try to get SVG dimensions f = open(img_path, 'r') svg = f.readlines(1024) # don't read all f.close() svg = "".join(svg).replace('\n', '') w = re.search('width="([0-9]+)(.*?)" ', svg) h = re.search('height="([0-9]+)(.*?)"', svg) (w_val, w_unit) = w.group(1,2) (h_val, h_unit) = h.group(1,2) # Graphviz seems to underestimate height/width for SVG images, # so we have to adjust them. # The correction factor seems to be constant. w_val, h_val = [1.35 * float(x) for x in (w_val, h_val)] width = unicode(w_val) + w_unit height = unicode(h_val) + h_unit except ValueError: width = height = '100%' # insert SVG, IE compatibility return tag.object( tag.embed(src=img_url, type="image/svg+xml", width=width, height=height), data=img_url, type="image/svg+xml", width=width, height=height) # for binary formats, add map elif URL_in_graph and os.path.exists(map_path): f = open(map_path, 'r') map = f.readlines() f.close() map = "".join(map).replace('\n', '') return tag(tag.map(Markup(map), id='G'+sha_key, name='G'+sha_key), tag.img(src=img_url, usemap="#G"+sha_key, alt=_("GraphViz image"))) else: return tag.img(src=img_url, alt=_("GraphViz image")) # Private methods def _expand_wiki_links(self, context, out_format, content): """Expand TracLinks that follow all URL= patterns.""" def expand(match): wiki_text = match.groups()[0] # TracLink ([1], source:file/, ...) link = extract_link(self.env, context, wiki_text) if isinstance(link, Element): href = link.attrib.get('href') name = link.children description = link.attrib.get('title', '') else: href = wiki_text description = None if out_format == 'svg': format = 'URL="javascript:window.parent.location.href=\'%s\'"' else: format = 'URL="%s"' url = format % href if description: url += '\ntooltip="%s"' % description \ .replace('"', '').replace('\n', '') return url return re.sub(r'URL="(.*?)"', expand, content) def _load_config(self): """Preprocess the graphviz trac.ini configuration.""" # if 'graphviz' not in self.config.sections(): # ... so what? the defaults might be good enough # check for the cache_dir entry self.cache_dir = self.cache_dir_option if not self.cache_dir: return _("The [graphviz] section is missing the cache_dir field.") if not os.path.isabs(self.cache_dir): self.cache_dir = os.path.join(self.env.path, self.cache_dir) if not os.path.exists(self.cache_dir): if self.cache_dir_option == self.DEFAULT_CACHE_DIR: os.mkdir(self.cache_dir) else: return _("The cache_dir '%(path)s' doesn't exist, " "please create it.", path=self.cache_dir) # Get optional configuration parameters from trac.ini. # check for the cmd_path entry and setup the various command paths cmd_paths = Graphviz.Cmd_Paths.get(sys.platform, []) if self.cmd_path: if not os.path.exists(self.cmd_path): return _("The '[graphviz] cmd_path' configuration entry " "is set to '%(path)s' but that path does not exist.", path=self.cmd_path) cmd_paths = [self.cmd_path] if not cmd_paths: return _("The '[graphviz] cmd_path' configuration entry " "is not set and there is no default for %(platform)s.", platform=sys.platform) self.cmds = {} pname = self._find_cmd(self.processor, cmd_paths) if not pname: return _("The default processor '%(proc)s' was not found " "in '%(paths)s'.", proc=self.processor, paths=cmd_paths) for name in Graphviz.Processors: pname = self._find_cmd(name, cmd_paths) if not pname: self.log.warn('The %s program was not found. ' 'The graphviz/%s macro will be disabled.' % (pname, name)) Graphviz.Processors.remove(name) self.cmds[name] = pname if self.png_anti_alias: self.rsvg_path = (self.rsvg_path_option or self._find_cmd('rsvg', cmd_paths)) if not (self.rsvg_path and os.path.exists(self.rsvg_path)): return _("The rsvg program is set to '%(path)s' but that path " "does not exist.", path=self.rsvg_path) # get default graph/node/edge attributes self.processor_options = [] defaults = [opt for opt in self.config.options('graphviz') if opt[0].startswith('default_')] for name, value in defaults: for prefix, optkey in [ ('default_graph_', '-G'), ('default_node_', '-N'), ('default_edge_', '-E')]: if name.startswith(prefix): self.processor_options.append("%s%s=%s" % (optkey, name.replace(prefix,''), value)) # setup mimetypes to support the IHTMLPreviewRenderer interface if 'graphviz' not in MIME_MAP: MIME_MAP['graphviz'] = 'application/graphviz' for processor in Graphviz.Processors: if processor not in MIME_MAP: MIME_MAP[processor] = 'application/graphviz' def _launch(self, encoded_input, *args): """Launch a process (cmd), and returns exitcode, stdout + stderr""" # Note: subprocess.Popen doesn't support unicode options arguments # (http://bugs.python.org/issue1759845) so we have to encode them. # Anyway, dot expects utf-8 or the encoding specified with -Gcharset. encoded_cmd = [] for arg in args: if isinstance(arg, unicode): arg = arg.encode(self.encoding, 'replace') encoded_cmd.append(arg) p = subprocess.Popen(encoded_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) if encoded_input: p.stdin.write(encoded_input) p.stdin.close() out = p.stdout.read() err = p.stderr.read() failure = p.wait() != 0 if failure or err or out: return (failure, tag.p(tag.br(), _("The command:"), tag.pre(repr(' '.join(encoded_cmd))), (_("succeeded but emitted the following output:"), _("failed with the following output:"))[failure], out and tag.pre(repr(out)), err and tag.pre(repr(err)))) else: return (False, None) def _error_div(self, msg): """Display msg in an error box, using Trac style.""" if isinstance(msg, str): msg = to_unicode(msg) self.log.error(msg) if isinstance(msg, unicode): msg = tag.pre(escape(msg)) return tag.div( tag.strong(_("Graphviz macro processor has detected an error. " "Please fix the problem before continuing.")), msg, class_="system-message") def _clean_cache(self): """ The cache manager (clean_cache) is an attempt at keeping the cache directory under control. When the cache manager determines that it should clean up the cache, it will delete files based on the file access time. The files that were least accessed will be deleted first. The graphviz section of the trac configuration file should have an entry called cache_manager to enable the cache cleaning code. If it does, then the cache_max_size, cache_min_size, cache_max_count and cache_min_count entries must also be there. """ if self.cache_manager: # os.stat gives back a tuple with: st_mode(0), st_ino(1), # st_dev(2), st_nlink(3), st_uid(4), st_gid(5), # st_size(6), st_atime(7), st_mtime(8), st_ctime(9) entry_list = {} atime_list = {} size_list = {} count = 0 size = 0 for name in os.listdir(self.cache_dir): #self.log.debug('clean_cache.entry: %s' % name) entry_list[name] = os.stat(os.path.join(self.cache_dir, name)) atime_list.setdefault(entry_list[name][7], []).append(name) count = count + 1 size_list.setdefault(entry_list[name][6], []).append(name) size = size + entry_list[name][6] atime_keys = atime_list.keys() atime_keys.sort() #self.log.debug('clean_cache.atime_keys: %s' % atime_keys) #self.log.debug('clean_cache.count: %d' % count) #self.log.debug('clean_cache.size: %d' % size) # In the spirit of keeping the code fairly simple, the # clearing out of files from the cache directory may # result in the count dropping below cache_min_count if # multiple entries are have the same last access # time. Same for cache_min_size. if count > self.cache_max_count or size > self.cache_max_size: while atime_keys and (self.cache_min_count < count or self.cache_min_size < size): key = atime_keys.pop(0) for file in atime_list[key]: os.unlink(os.path.join(self.cache_dir, file)) count = count - 1 size = size - entry_list[file][6] def _find_cmd(self, cmd, paths): exe_suffix = '' if sys.platform == 'win32': exe_suffix = '.exe' for path in paths: p = os.path.join(path, cmd) + exe_suffix if os.path.exists(p): return p graphvizplugin/0.11-0.7.5/README.txt0000444000175000017500000002163611077035662015022 0ustar wmbwmbTrac Graphviz Wiki Processor ---------------------------- Description =========== The graphviz wiki processor is a plugin for Trac that allows the the dynamic generation of diagrams by the various graphviz programs. The text of a wiki page can contain the source text for graphviz and the web browser will show the resulting image. Simple Example ++++++++++++++ A simple example would be:: #!graphviz digraph G {Hello->World->Graphviz->Rules} There are also several additional examples available in the examples directory. They can be loaded into a Trac installation by the examples/load_examples.py program. Once loaded, navigate to the wiki/GraphvizExamples page to access the examples. Usage Details +++++++++++++ The graphviz wiki processor supports all 5 graphviz drawing programs: dot, neato, twopi, circo and fdp. By default, the dot program is used to generate the images. The different programs can be invoked using one of these:: #!graphviz #!graphviz.dot #!graphviz.neato #!graphviz.twopi #!graphviz.circo #!graphviz.fdp The supported image formats are: png (default), gif, jpg, svg and svgz. The format can be specified using a "/format" modifier, in the hashbang, as shown below:: #!graphviz/svg #!graphviz.dot/png #!graphviz.circo/gif Platform Specific Requirements ============================== FreeBSD +++++++ On FreeBSD systems, installing the x11-fonts/urwfonts package will provide the fonts needed for graphviz to correctly generate images. Optional requirements ===================== To allow antialiasing of PNG images produced by graphviz, you need to have rsvg, the librsvg rasterizer, installed on your system. It can be downloaded from . Note that rsvg is not available for Windows. Installation via Source ======================= The installation of the graphviz plugin from source is done by creating a Python egg distribution file and copying the .egg file to the Trac plugins directory. Detailed information on Python eggs can be found at: http://peak.telecommunity.com/DevCenter/PythonEggs. In addition, the Easy Install package is required to create Python eggs. See http://peak.telecommunity.com/DevCenter/EasyInstall for more information on using and installing Easy Install. Download the source code for the graphviz plugin from http://trac-hacks.swapoff.org/download/graphvizplugin.zip or checkout the source from the trac hacks subversion repository at: http://trac-hacks.swapoff.org/svn/graphvizplugin. Change to the graphvizplugin/0.11 directory and run:: python setup.py bdist_egg This will generate a python egg in the dist directory. Copy the egg file into the trac/plugins directory and follow the Configuration steps outlined below. Installation via Egg ==================== todo Configuration ============= Once the graphviz plugin has been installed either via source or via a python egg, some changes to the conf/trac.ini file must be done before it can be used. As for any plugin, if you did a global installation (as opposed to simply dropping the .egg in the plugins folder of your Trac environment), you first need to enable it:: [components] graphviz.* = enabled A new section called ``[graphviz]`` should be added to the trac.ini file with these fields:: cache_dir - The directory that will be used to cache the generated images. That directory must exist, unless you keep the default 'gvcache' value, in which case the plugin is allowed to create the folder inside the Trac environment. cmd_path - Full path to the directory where the graphviz programs are located. If not specified, the default is /usr/bin on Linux, c:\Program Files\ATT\Graphviz\bin on Windows and /usr/local/bin on FreeBSD 6. out_format - Graph output format. Valid formats are: png, jpg, svg, svgz, gif. If not specified, the default is png. This setting can be overrided on a per-graph basis. processor - Graphviz default processor. Valid processors are: dot, neato, twopi, fdp, circo. If not specified, the default is dot. This setting can be overrided on a per-graph basis. GraphvizMacro will verify that the default processor is installed and will not work if it is missing. All other processors are optional. If any of the other processors are missing, a warning message will be sent to the trac log and GraphvizMacro will continue to work. png_antialias - If this entry exists in the configuration file, then PNG outputs will be antialiased. rsvg_path - Full path to the rsvg program (including the filename). The default is `/rsvg`. default_* - These settings define the default graph, node and edge attributes. They must be written as: default_TYPE_ATTRIBUTE = VALUE where TYPE is one of graph, node, edge ATTRIBUTE is a valid graphviz attribute VALUE is the attribute value. eg: default_edge_fontname = "Andale Mono" default_graph_fontsize = 10 cache_manager - If this entry exists in the configuration file, then the cache management logic will be invoked and the cache_max_size, cache_min_size, cache_max_count and cache_min_count must be defined. cache_max_size - The maximum size in bytes that the cache should consume. This is the high watermark for disk space used. cache_min_size - When cleaning out the cache, remove files until this size in bytes is used by the cache. This is the low watermark for disk space used. cache_max_count - The maximum number of files that the cache should contain. This is the high watermark for the directory entry count. The cache_dir directory must exist and the trac server must have read and write access. The cache manager is an attempt at keeping the cache directory under control. This is experimental code that may cause more problems than it fixes. The cache manager will be invoked only if a new graphviz image is to be produced. If the image can be loaded from the cache, then the cache manager shouldn't need to run. This should minimize the I/O performance impact on the trac server. When the cache manager determines that it should clean up the cache, it will delete files based on the file access time. The files that were least accessed will be deleted first. Configuration Example +++++++++++++++++++++ Here is a sample graphviz section:: [graphviz] cache_dir = /tmp/trac/htdocs/graphviz png_antialias = true default_graph_fontname = "Andale Mono" default_graph_fontsize = 10 Here is a sample graphviz section that activates the cache manager:: [graphviz] cache_dir = /tmp/trac/htdocs/graphviz png_antialias = true default_graph_fontname = "Andale Mono" default_graph_fontsize = 10 cache_manager = yes cache_max_size = 10000000 cache_min_size = 5000000 cache_max_count = 2000 cache_min_count = 1500 The cache manager is turned on since there is an entry in the graphviz section called cache_manager. The value doesn't matter. To turn off the cache manager, simply comment out the cache_manager entry. When the size of all the files in the cache directory exceeds 10,000,000 bytes or the number of files in the cache directory exceeds 2,000, then files are deleted until the size is less than 5,000,000 bytes and the number of files is less than 1,500. Here's the same example but for Windows systems:: [graphviz] cache_dir = C:\projects\plugins\env\trac\htdocs\graphviz cache_manager = yes cache_max_size = 10000000 cache_min_size = 5000000 cache_max_count = 2000 cache_min_count = 1500 Notice that the png_antialias, rsvg_path, default_graph_fontname and default_graph_fontsize are not defined. This is because rsvg is not available on Windows and these options are not used. Contributors ============ I'd like to extend my thanks to following people: * Kilian Cavalotti for * the code to allow the output format to be specified system wide and per diagram. * work on the code to expand Trac wiki links within Graphviz diagrams. * Alec Thomas for creating Trac Hacks (http://trac-hacks.swapoff.org) and providing hosting for the Graphviz module. * Emmanuel Blot for the swift kick in the butt to get the 0.9 - 0.10 releated bug fixes resolved ;-) $Id$