diff -Nru python-pygraphviz-1.1/INSTALL.txt python-pygraphviz-1.2/INSTALL.txt --- python-pygraphviz-1.1/INSTALL.txt 2011-05-14 18:12:14.000000000 +0000 +++ python-pygraphviz-1.2/INSTALL.txt 2013-08-03 15:57:19.000000000 +0000 @@ -10,12 +10,26 @@ or install it with:: + pip install pygraphviz + +and an attempt will be made to find and install an appropriate version +that matches your operating system and Python version. + +You can install the development version (at github.com) with:: + + pip install git://github.com/pygraphviz/pygraphviz.git#egg=pygraphviz + + +Get PyGraphviz from the Python Package Index at +http://pypi.python.org/pypi/pygraphviz + +or install it with:: + easy_install pygraphviz and an attempt will be made to find and install an appropriate version that matches your operating system and Python version. -More download options are at http://networkx.lanl.gov/download.html Installing from Source ====================== @@ -36,85 +50,66 @@ 4. (optional) Run "python setup_egg.py nosetests" to execute the tests -SVN Repository --------------- +Github +------ + + 1. Clone the pygraphviz repostitory - 1. Check out the PyGraphviz trunk:: + git clone https://github.com/pygraphviz/pygraphviz.git - svn co https://networkx.lanl.gov/svn/pygraphviz/trunk pygraphviz + (see https://github.com/pygraphviz/pygraphviz/ for other options) - 2. Change directory to "pygraphviz" + 2. Change directory to "pygraphviz" - 3. Run "python setup.py install" to build and install + 3. Run "python setup.py install" to build and install 4. (optional) Run "python setup_egg.py nosetests" to execute the tests If you don't have permission to install software on your system, you can install into another directory using -the --prefix or --home flags to setup.py. +the --user, --prefix, or --home flags to setup.py. For example -:: +:: python setup.py install --prefix=/home/username/python or python setup.py install --home=~ + or + python setup.py install --user If you didn't install in the standard Python site-packages directory you will need to set your PYTHONPATH variable to the alternate location. -See http://docs.python.org/inst/search-path.html for further details. +Seehttp://docs.python.org/2/install/index.html#search-path for further details. Requirements ============ -GraphViz --------- - -To use PyGraphviz you need GraphViz version 2.16 or later. -Some versions have known bugs that have been fixed; get the latest -release available for best results. - - - Official site: http://www.graphviz.org - - Python ------ -To use PyGraphviz you need Python version 2.4 or later http://www.python.org/ +To use PyGraphviz you need Python version 2.6.x or 2.7.x. +PyGraphviz does not work with Python 3 The easiest way to get Python and most optional packages is to install -the Enthought Python distribution -http://www.enthought.com/products/epd.php - -Other options are - -Windows -~~~~~~~ - - Official Python site version: http://www.python.org/download/ - - - ActiveState version: http://activestate.com/Products/ActivePython/ - -OSX -~~~ - -OSX 10.5 ships with Python version 2.5. If you -have an older version we encourage you to download -a newer release. Pre-built Python packages are available from +the Enthought Python distribution "Canopy" +https://www.enthought.com/products/canopy/ - - Official Python site version http://www.python.org/download/ +There are several other distributions that contain the key packages you need for scientific computing. See the following link for a list: http://scipy.org/install.html - - Pythonmac http://www.pythonmac.org/packages/ - - ActiveState http://activestate.com/Products/ActivePython/ +Requirements +============ +GraphViz +-------- -If you are using Fink or MacPorts, Python is available through both -of those package systems. +To use PyGraphviz you need GraphViz version 2.16 or later. +Some versions have known bugs that have been fixed; get the latest +release available for best results. -Linux -~~~~~ -Python is included in all major Linux distributions + - Official site: http://www.graphviz.org diff -Nru python-pygraphviz-1.1/PKG-INFO python-pygraphviz-1.2/PKG-INFO --- python-pygraphviz-1.1/PKG-INFO 2011-05-14 18:12:16.000000000 +0000 +++ python-pygraphviz-1.2/PKG-INFO 2013-08-03 15:57:55.000000000 +0000 @@ -1,13 +1,13 @@ -Metadata-Version: 1.0 +Metadata-Version: 1.1 Name: pygraphviz -Version: 1.1 +Version: 1.2 Summary: Python interface to Graphviz -Home-page: http://networkx.lanl.gov/pygraphviz +Home-page: http://pygraphviz.github.io Author: Aric Hagberg -Author-email: hagberg@lanl.gov +Author-email: aric.hagberg@gmail.com License: BSD -Download-URL: http://networkx.lanl.gov/download/pygraphviz -Description: PyGraphviz is a Python interface to the Graphviz graph layout and visualization package. With PyGraphviz you can create, edit, read, write, and draw graphs using Python to access the Graphviz graph data structure and layout algorithms. PyGraphviz is independent from NetworkX but provides a similar programming interface. +Download-URL: https://pypi.python.org/pypi/pygraphviz +Description: PyGraphviz is a Python interface to the Graphviz graph layout and visualization package. With PyGraphviz you can create, edit, read, write, and draw graphs using Python to access the Graphviz graph data structure and layout algorithms. PyGraphviz provides a similar programming interface to NetworkX (http://networkx.github.io). Keywords: Networks,Graph Visualization,network,graph,graph drawing Platform: Linux diff -Nru python-pygraphviz-1.1/README.txt python-pygraphviz-1.2/README.txt --- python-pygraphviz-1.1/README.txt 2011-05-14 18:12:14.000000000 +0000 +++ python-pygraphviz-1.2/README.txt 2013-08-03 15:57:19.000000000 +0000 @@ -9,8 +9,8 @@ PyGraphviz is distributed with a BSD license. -Copyright (C) 2006-2011 by -Aric Hagberg +Copyright (C) 2006-2013 by +Aric Hagberg Dan Schult Manos Renieris, http://www.cs.brown.edu/~er/ Distributed with BSD license. diff -Nru python-pygraphviz-1.1/debian/changelog python-pygraphviz-1.2/debian/changelog --- python-pygraphviz-1.1/debian/changelog 2012-05-06 15:20:25.000000000 +0000 +++ python-pygraphviz-1.2/debian/changelog 2013-08-05 21:36:17.000000000 +0000 @@ -1,3 +1,20 @@ +python-pygraphviz (1.2-1) unstable; urgency=low + + [ Jakub Wilk ] + * Use canonical URIs for Vcs-* fields. + + [ Sandro Tosi ] + * New upstream release + * debian/watch + - updated for new upstream tarballs location + * debian/copyright + - update upstream copyright years and author email + - extended packaging copyright years + * debian/control + - bump Standards-Version to 3.9.4 (no changes needed) + + -- Sandro Tosi Mon, 05 Aug 2013 23:36:04 +0200 + python-pygraphviz (1.1-2) unstable; urgency=low * debian/rules diff -Nru python-pygraphviz-1.1/debian/control python-pygraphviz-1.2/debian/control --- python-pygraphviz-1.1/debian/control 2011-06-09 15:02:31.000000000 +0000 +++ python-pygraphviz-1.2/debian/control 2013-08-04 13:33:51.000000000 +0000 @@ -4,11 +4,11 @@ Maintainer: Debian Python Modules Team Uploaders: Sandro Tosi Build-Depends: debhelper (>= 5), cdbs (>= 0.4.43), python-support (>= 0.6.4), python-all-dev (>= 2.3.5-11), python-all-dbg, libgraphviz-dev, python-setuptools, pkg-config -Standards-Version: 3.9.2 +Standards-Version: 3.9.4 XS-Python-Version: >= 2.5 Homepage: http://networkx.lanl.gov/pygraphviz/ -Vcs-Svn: svn://svn.debian.org/python-modules/packages/python-pygraphviz/trunk/ -Vcs-Browser: http://svn.debian.org/viewsvn/python-modules/packages/python-pygraphviz/trunk/ +Vcs-Svn: svn://anonscm.debian.org/python-modules/packages/python-pygraphviz/trunk/ +Vcs-Browser: http://anonscm.debian.org/viewvc/python-modules/packages/python-pygraphviz/trunk/ Package: python-pygraphviz Architecture: any diff -Nru python-pygraphviz-1.1/debian/copyright python-pygraphviz-1.2/debian/copyright --- python-pygraphviz-1.1/debian/copyright 2011-06-09 15:02:31.000000000 +0000 +++ python-pygraphviz-1.2/debian/copyright 2013-08-04 13:30:22.000000000 +0000 @@ -5,14 +5,14 @@ Upstream Authors: - Aric Hagberg + Aric Hagberg Dan Schult Manos Renieris, http://www.cs.brown.edu/~er/ Copyright: - Copyright (C) 2004-2011 by - Aric Hagberg + Copyright (C) 2004-2013 by + Aric Hagberg Dan Schult Manos Renieris, http://www.cs.brown.edu/~er/ @@ -85,5 +85,5 @@ The Debian packaging is: © 2006-2008, Cyril Brulebois - © 2010-2011, Sandro Tosi + © 2010-2013, Sandro Tosi and is licensed under the GPL, see `/usr/share/common-licenses/GPL'. diff -Nru python-pygraphviz-1.1/debian/watch python-pygraphviz-1.2/debian/watch --- python-pygraphviz-1.1/debian/watch 2010-06-23 17:50:41.000000000 +0000 +++ python-pygraphviz-1.2/debian/watch 2013-08-04 13:24:12.000000000 +0000 @@ -1,3 +1,4 @@ version=3 -http://networkx.lanl.gov/download/pygraphviz/pygraphviz-([\d\.]*)\.tar.gz +opts="uversionmangle=s/rc/~rc/" \ + http://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-(.*)\.tar.gz diff -Nru python-pygraphviz-1.1/doc/Makefile python-pygraphviz-1.2/doc/Makefile --- python-pygraphviz-1.1/doc/Makefile 2011-05-14 18:12:14.000000000 +0000 +++ python-pygraphviz-1.2/doc/Makefile 2013-08-03 15:57:19.000000000 +0000 @@ -11,96 +11,118 @@ PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source -.PHONY: help clean html web pickle htmlhelp latex changes linkcheck doctest +.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest epub help: @echo "Please use \`make ' where is one of" - @echo " dist to make a distribution-ready tree" @echo " html to make standalone HTML files" - @echo " pickle to make pickle files (usable by e.g. sphinx-web)" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " pickle to make pickle files" + @echo " epub to make an epub" + @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " changes to make an overview over all changed/added/deprecated items" + @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + clean: - -rm -rf build/* + -rm -rf build/* source/reference/generated/* source/examples/* source/static/examples doc/source/*.pdf doc/source/*.zip + -rm -rf ../examples/*/*.png + +generate: build/generate-stamp +build/generate-stamp: $(wildcard source/reference/*.rst) + mkdir -p build + touch build/generate-stamp + dist: html test -d build/latex || make latex make -C build/latex all-pdf -rm -rf build/dist (cd build/html; cp -r . ../../build/dist) +# -rm -f build/dist/_downloads/* +# -mkdir build/dist/_downloads +# (cd build/html && zip -9r ../dist/_downloads/pygraphviz-documentation.zip .) (cd build/html && zip -9r ../dist/pygraphviz-documentation.zip .) - cp build/latex/*.pdf build/dist - (cd build/dist && tar czf ../dist.tar.gz .) - -generate: build/generate-stamp - -build/generate-stamp: - mkdir -p build -# ./sphinxext/numpyext/autosummary_generate.py source/reference/*.rst \ -# -p dump.xml -o source/reference/generated -# ./make_gallery.py -# ./make_examples_rst.py ../examples source - touch build/generate-stamp +# cp build/latex/*.pdf build/dist/_downloads + cp build/latex/*.pdf build/dist/ +# (cd build/dist && ln -s _downloads/* .) +# (cd build/dist && tar czf ../dist.tar.gz .) -ext-svn: - svn co http://sphinx.googlecode.com/svn/contrib/trunk/numpyext sphinxext/numpyext -html: generate - mkdir -p build/html build/doctrees +html: generate + touch source/pygraphviz.pdf + touch source/pygraphviz-documentation.zip $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html -# python postprocess.py html build/html/*.html @echo @echo "Build finished. The HTML pages are in build/html." +dirhtml: generate + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) build/dirhtml + @echo + @echo "Build finished. The HTML pages are in build/dirhtml." + pickle: generate - mkdir -p build/pickle build/doctrees $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle @echo - @echo "Build finished; now you can process the pickle files or run" - @echo " sphinx-web build/pickle" - @echo "to start the sphinx-web server." + @echo "Build finished; now you can process the pickle files." -web: pickle +json: generate + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) build/json + @echo + @echo "Build finished; now you can process the JSON files." htmlhelp: generate - mkdir -p build/htmlhelp build/doctrees $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in build/htmlhelp." +qthelp: generate + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) build/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in build/qthelp, like this:" + @echo "# qcollectiongenerator build/qthelp/test.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile build/qthelp/test.qhc" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) build/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + + latex: generate - mkdir -p build/latex build/doctrees $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex -# python postprocess.py tex build/latex/*.tex @echo @echo "Build finished; the LaTeX files are in build/latex." @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ "run these through (pdf)latex." -coverage: build - mkdir -p build/coverage build/doctrees - $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) build/coverage - @echo "Coverage finished; see c.txt and python.txt in build/coverage" - -changes: generate - mkdir -p build/changes build/doctrees +changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes @echo @echo "The overview file is in build/changes." linkcheck: generate - mkdir -p build/linkcheck build/doctrees $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in build/linkcheck/output.txt." doctest: generate - mkdir -p build/linkcheck build/doctrees $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) build/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in build/doctest/output.txt." + +gh-pages: clean dist + python gh-pages.py $(tag) + +gitwash-update: + python gitwash_dumper.py source/developer pygraphviz \ + --project-url=http://pygraphviz.github.io \ + --project-ml-url=http://groups.google.com/group/pygraphviz-discuss/ diff -Nru python-pygraphviz-1.1/doc/gh-pages.py python-pygraphviz-1.2/doc/gh-pages.py --- python-pygraphviz-1.1/doc/gh-pages.py 1970-01-01 00:00:00.000000000 +0000 +++ python-pygraphviz-1.2/doc/gh-pages.py 2013-08-03 15:57:19.000000000 +0000 @@ -0,0 +1,140 @@ +#!/usr/bin/env python +"""Script to commit the doc build outputs into the github-pages repo. + +Use: + + gh-pages.py [tag] + +If no tag is given, the current output of 'git describe' is used. If given, +that is how the resulting directory will be named. + +In practice, you should use either actual clean tags from a current build or +something like 'current' as a stable URL for the most current version""" +# Borrowed from IPython. + +#----------------------------------------------------------------------------- +# Imports +#----------------------------------------------------------------------------- +import os +import re +import shutil +import sys +from os import chdir as cd +from os.path import join as pjoin + +from subprocess import Popen, PIPE, CalledProcessError, check_call + +#----------------------------------------------------------------------------- +# Globals +#----------------------------------------------------------------------------- + +pages_dir = 'gh-pages' +html_dir = 'build/dist' +pdf_dir = 'build/latex' +pages_repo = 'git@github.com:pygraphviz/documentation.git' + +#----------------------------------------------------------------------------- +# Functions +#----------------------------------------------------------------------------- +def sh(cmd): + """Execute command in a subshell, return status code.""" + return check_call(cmd, shell=True) + + +def sh2(cmd): + """Execute command in a subshell, return stdout. + + Stderr is unbuffered from the subshell.x""" + p = Popen(cmd, stdout=PIPE, shell=True) + out = p.communicate()[0] + retcode = p.returncode + if retcode: + raise CalledProcessError(retcode, cmd) + else: + return out.rstrip() + + +def sh3(cmd): + """Execute command in a subshell, return stdout, stderr + + If anything appears in stderr, print it out to sys.stderr""" + p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True) + out, err = p.communicate() + retcode = p.returncode + if retcode: + raise CalledProcessError(retcode, cmd) + else: + return out.rstrip(), err.rstrip() + + +def init_repo(path): + """clone the gh-pages repo if we haven't already.""" + sh("git clone %s %s"%(pages_repo, path)) + here = os.getcwdu() + cd(path) + sh('git checkout gh-pages') + cd(here) + +#----------------------------------------------------------------------------- +# Script starts +#----------------------------------------------------------------------------- +if __name__ == '__main__': + # The tag can be given as a positional argument + try: + tag = sys.argv[1] + except IndexError: + try: + tag = sh2('git describe --exact-match') + except CalledProcessError: + print("using development as label") + tag = "development" # Fallback + + startdir = os.getcwdu() + if not os.path.exists(pages_dir): + # init the repo + init_repo(pages_dir) + else: + # ensure up-to-date before operating + cd(pages_dir) + sh('git checkout gh-pages') + sh('git pull') + cd(startdir) + + dest = pjoin(pages_dir, tag) + + # don't `make html` here, because gh-pages already depends on html in Makefile + # sh('make html') + if tag != 'dev': + # only build pdf for non-dev targets + #sh2('make pdf') + pass + + # This is pretty unforgiving: we unconditionally nuke the destination + # directory, and then copy the html tree in there + shutil.rmtree(dest, ignore_errors=True) + shutil.copytree(html_dir, dest) + if tag != 'dev': + #shutil.copy(pjoin(pdf_dir, 'ipython.pdf'), pjoin(dest, 'ipython.pdf')) + pass + + try: + cd(pages_dir) + status = sh2('git status | head -1') + branch = re.match('\# On branch (.*)$', status).group(1) + if branch != 'gh-pages': + e = 'On %r, git branch is %r, MUST be "gh-pages"' % (pages_dir, + branch) + raise RuntimeError(e) + + sh('git add -A %s' % tag) + sh('git commit -m"Updated doc release: %s"' % tag) + print + print 'Most recent 3 commits:' + sys.stdout.flush() + sh('git --no-pager log --oneline HEAD~3..') + finally: + cd(startdir) + + print + print 'Now verify the build in: %r' % dest + print "If everything looks good, 'git push'" diff -Nru python-pygraphviz-1.1/doc/source/conf.py python-pygraphviz-1.2/doc/source/conf.py --- python-pygraphviz-1.1/doc/source/conf.py 2011-05-14 18:12:14.000000000 +0000 +++ python-pygraphviz-1.2/doc/source/conf.py 2013-08-03 15:57:19.000000000 +0000 @@ -35,11 +35,11 @@ source_encoding = 'utf-8' # The master toctree document. -master_doc = 'contents' +master_doc = 'index' # General substitutions. project = 'PyGraphviz' -copyright = '2010, Aric Hagberg' +copyright = '2013, PyGraphviz Developers' # The default replacements for |version| and |release|, also used in various # other places throughout the built documents. @@ -95,19 +95,19 @@ #html_use_smartypants = True # Content template for the index page. -html_index = 'index.html' +html_index = 'contents.html' # Custom sidebar templates, maps page names to templates. -html_sidebars = {'index': 'indexsidebar.html'} +#html_sidebars = {'index': 'indexsidebar.html'} # Additional templates that should be rendered to pages, maps page names to # templates. -html_additional_pages = {'index': 'index.html'} +#html_additional_pages = {'index': 'index.html'} # If true, the reST sources are included in the HTML build as _sources/. html_copy_source = False -html_use_opensearch = 'http://networkx.lanl.gov' +html_use_opensearch = 'http://pygraphviz.github.io' # Output file base name for HTML help builder. htmlhelp_basename = 'PyGraphviz' @@ -125,8 +125,8 @@ # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, document class [howto/manual]). -latex_documents = [('contents', 'pygraphviz.tex', 'PyGraphviz Documentation', - 'Aric Hagberg, Dan Schult', 'manual', 1)] +latex_documents = [('index', 'pygraphviz.tex', 'PyGraphviz Documentation', + 'PyGraphviz Developers', 'manual', 1)] #latex_use_parts = True diff -Nru python-pygraphviz-1.1/doc/source/contents.rst python-pygraphviz-1.2/doc/source/contents.rst --- python-pygraphviz-1.1/doc/source/contents.rst 2011-05-14 18:12:14.000000000 +0000 +++ python-pygraphviz-1.2/doc/source/contents.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -.. _contents: - -************************ -PyGraphviz documentation -************************ - -.. only:: html - - :Release: |version| - :Date: |today| - - Download `PDF `_ - `HTML `_ - - -.. toctree:: - :maxdepth: 2 - - - install - tutorial - reference/index - examples - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - diff -Nru python-pygraphviz-1.1/doc/source/download.rst python-pygraphviz-1.2/doc/source/download.rst --- python-pygraphviz-1.1/doc/source/download.rst 2011-05-14 18:12:14.000000000 +0000 +++ python-pygraphviz-1.2/doc/source/download.rst 2013-08-03 15:57:19.000000000 +0000 @@ -2,31 +2,19 @@ Download -------- -Source and Binary Releases -~~~~~~~~~~~~~~~~~~~~~~~~~~ +Software +~~~~~~~~ +Source and binary releases: https://pypi.python.org/pypi/pygraphviz -http://cheeseshop.python.org/pypi/pygraphviz/ +Github (latest development): https://github.com/pygraphviz/pygraphviz -http://networkx.lanl.gov/download/pygraphviz/ - - -Subversion Source Code Repository -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*Anonymous* - -svn checkout http://networkx.lanl.gov/svn/pygraphviz/trunk pygraphviz - -*Authenticated* - -svn checkout https://networkx.lanl.gov/svn/pygraphviz/trunk pygraphviz Documentation ~~~~~~~~~~~~~ - *PDF* -http://networkx.lanl.gov/pygraphviz/pygraphviz.pdf +http://pygraphviz.github.io/documentation/latest/pygraphviz.pdf *HTML in zip file* -http://networkx.lanl.gov/pygraphviz/pygraphviz-documentation.zip +http://pygraphviz.github.io/documentation/latest/pygraphviz-documentation.zip diff -Nru python-pygraphviz-1.1/doc/source/examples.rst python-pygraphviz-1.2/doc/source/examples.rst --- python-pygraphviz-1.1/doc/source/examples.rst 2011-05-14 18:12:14.000000000 +0000 +++ python-pygraphviz-1.2/doc/source/examples.rst 2013-08-03 15:57:19.000000000 +0000 @@ -2,23 +2,23 @@ ======== See the examples for sample usage and ideas - https://networkx.lanl.gov/trac/browser/pygraphviz/trunk/examples/ + http://github.com/pygraphviz/pygraphviz/tree/master/examples There is a complete reference guide at - https://networkx.lanl.gov/pygraphviz/reference + http://pygraphviz.github.io/documentation/latest Simple ~~~~~~ A basic example showing how to read and write dot files and draw graphs. - https://networkx.lanl.gov/trac/browser/pygraphviz/trunk//examples/simple.py + http://github.com/pygraphviz/pygraphviz/tree/master/examples/simple.py Star ~~~~ An example showing how to set attributes. - https://networkx.lanl.gov/trac/browser/pygraphviz/trunk/examples/star.py + http://github.com/pygraphviz/pygraphviz/tree/master/examples/star.py Miles @@ -26,4 +26,4 @@ An example showing how to use Graphviz to draw a graph with given positions. - https://networkx.lanl.gov/trac/browser/pygraphviz/trunk/examples/miles.py + http://github.com/pygraphviz/pygraphviz/tree/master/examples/miles.py diff -Nru python-pygraphviz-1.1/doc/source/index.rst python-pygraphviz-1.2/doc/source/index.rst --- python-pygraphviz-1.1/doc/source/index.rst 1970-01-01 00:00:00.000000000 +0000 +++ python-pygraphviz-1.2/doc/source/index.rst 2013-08-03 15:57:19.000000000 +0000 @@ -0,0 +1,32 @@ +.. _contents: + +************************ +PyGraphviz documentation +************************ + +.. only:: html + + :Release: |version| + :Date: |today| + + Download `PDF `_ + `HTML `_ + + +.. toctree:: + :maxdepth: 2 + + + install + tutorial + reference/index + examples + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff -Nru python-pygraphviz-1.1/doc/source/install.rst python-pygraphviz-1.2/doc/source/install.rst --- python-pygraphviz-1.1/doc/source/install.rst 2011-05-14 18:12:14.000000000 +0000 +++ python-pygraphviz-1.2/doc/source/install.rst 2013-08-03 15:57:19.000000000 +0000 @@ -10,12 +10,26 @@ or install it with:: + pip install pygraphviz + +and an attempt will be made to find and install an appropriate version +that matches your operating system and Python version. + +You can install the development version (at github.com) with:: + + pip install git://github.com/pygraphviz/pygraphviz.git#egg=pygraphviz + + +Get PyGraphviz from the Python Package Index at +http://pypi.python.org/pypi/pygraphviz + +or install it with:: + easy_install pygraphviz and an attempt will be made to find and install an appropriate version that matches your operating system and Python version. -More download options are at http://networkx.lanl.gov/download.html Installing from Source ====================== @@ -36,85 +50,66 @@ 4. (optional) Run "python setup_egg.py nosetests" to execute the tests -SVN Repository --------------- +Github +------ + + 1. Clone the pygraphviz repostitory - 1. Check out the PyGraphviz trunk:: + git clone https://github.com/pygraphviz/pygraphviz.git - svn co https://networkx.lanl.gov/svn/pygraphviz/trunk pygraphviz + (see https://github.com/pygraphviz/pygraphviz/ for other options) - 2. Change directory to "pygraphviz" + 2. Change directory to "pygraphviz" - 3. Run "python setup.py install" to build and install + 3. Run "python setup.py install" to build and install 4. (optional) Run "python setup_egg.py nosetests" to execute the tests If you don't have permission to install software on your system, you can install into another directory using -the --prefix or --home flags to setup.py. +the --user, --prefix, or --home flags to setup.py. For example -:: +:: python setup.py install --prefix=/home/username/python or python setup.py install --home=~ + or + python setup.py install --user If you didn't install in the standard Python site-packages directory you will need to set your PYTHONPATH variable to the alternate location. -See http://docs.python.org/inst/search-path.html for further details. +Seehttp://docs.python.org/2/install/index.html#search-path for further details. Requirements ============ -GraphViz --------- - -To use PyGraphviz you need GraphViz version 2.16 or later. -Some versions have known bugs that have been fixed; get the latest -release available for best results. - - - Official site: http://www.graphviz.org - - Python ------ -To use PyGraphviz you need Python version 2.4 or later http://www.python.org/ +To use PyGraphviz you need Python version 2.6.x or 2.7.x. +PyGraphviz does not work with Python 3 The easiest way to get Python and most optional packages is to install -the Enthought Python distribution -http://www.enthought.com/products/epd.php - -Other options are - -Windows -~~~~~~~ - - Official Python site version: http://www.python.org/download/ - - - ActiveState version: http://activestate.com/Products/ActivePython/ - -OSX -~~~ - -OSX 10.5 ships with Python version 2.5. If you -have an older version we encourage you to download -a newer release. Pre-built Python packages are available from +the Enthought Python distribution "Canopy" +https://www.enthought.com/products/canopy/ - - Official Python site version http://www.python.org/download/ +There are several other distributions that contain the key packages you need for scientific computing. See the following link for a list: http://scipy.org/install.html - - Pythonmac http://www.pythonmac.org/packages/ - - ActiveState http://activestate.com/Products/ActivePython/ +Requirements +============ +GraphViz +-------- -If you are using Fink or MacPorts, Python is available through both -of those package systems. +To use PyGraphviz you need GraphViz version 2.16 or later. +Some versions have known bugs that have been fixed; get the latest +release available for best results. -Linux -~~~~~ -Python is included in all major Linux distributions + - Official site: http://www.graphviz.org diff -Nru python-pygraphviz-1.1/doc/source/reference/api_notes.rst python-pygraphviz-1.2/doc/source/reference/api_notes.rst --- python-pygraphviz-1.1/doc/source/reference/api_notes.rst 2011-05-14 18:12:14.000000000 +0000 +++ python-pygraphviz-1.2/doc/source/reference/api_notes.rst 2013-08-03 15:57:19.000000000 +0000 @@ -1,6 +1,10 @@ API Notes ========= +pygraphviz-1.2 +-------------- + No API changes + pygraphviz-1.1 -------------- Pygraphviz-1.1 adds unicode (graphviz charset) support. diff -Nru python-pygraphviz-1.1/doc/source/reference/news.rst python-pygraphviz-1.2/doc/source/reference/news.rst --- python-pygraphviz-1.1/doc/source/reference/news.rst 2011-05-14 18:12:14.000000000 +0000 +++ python-pygraphviz-1.2/doc/source/reference/news.rst 2013-08-03 15:57:19.000000000 +0000 @@ -3,6 +3,13 @@ News ==== +pygraphviz-1.2 +----------------- +Release date: 3 August 2013 + + - Quote Graphviz program names to work with space (Windows fix) + - Keep name in reverse() + pygraphviz-1.1 ----------------- Release date: 9 February 2011 diff -Nru python-pygraphviz-1.1/doc/source/templates/layout.html python-pygraphviz-1.2/doc/source/templates/layout.html --- python-pygraphviz-1.1/doc/source/templates/layout.html 2011-05-14 18:12:14.000000000 +0000 +++ python-pygraphviz-1.2/doc/source/templates/layout.html 2013-08-03 15:57:19.000000000 +0000 @@ -1,11 +1,12 @@ {% extends "!layout.html" %} {% block rootrellink %} -
  • PyGraphviz Home
  • -
  • Search
  • -
  • Download
  • -
  • Developer Site
  • -
  • Documentation »
  • +
  • PyGraphviz Home
  • +
  • Documentation
  • +
  • Download
  • +
  • Developer (Github)
  • + + {% endblock %} {% block relbar1 %} diff -Nru python-pygraphviz-1.1/doc/source/tutorial.rst python-pygraphviz-1.2/doc/source/tutorial.rst --- python-pygraphviz-1.1/doc/source/tutorial.rst 2011-05-14 18:12:14.000000000 +0000 +++ python-pygraphviz-1.2/doc/source/tutorial.rst 2013-08-03 15:57:19.000000000 +0000 @@ -2,9 +2,9 @@ ======== The API is very similar to that of NetworkX. Much of the -NetworkX tutorial at http://networkx.lanl.gov/tutorial/ +NetworkX tutorial at http://networkx.github.io/documentation/latest/tutorial/ is applicable to PyGraphviz. -See https://networkx.lanl.gov/pygraphviz/reference/api_notes.html for major differences. +See http://pygraphviz.github.io/documentation/latest/reference/api_notes.html for major differences. Start-up -------- diff -Nru python-pygraphviz-1.1/pygraphviz/agraph.py python-pygraphviz-1.2/pygraphviz/agraph.py --- python-pygraphviz-1.1/pygraphviz/agraph.py 2011-05-14 18:12:14.000000000 +0000 +++ python-pygraphviz-1.2/pygraphviz/agraph.py 2013-08-03 15:57:19.000000000 +0000 @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- """ -A Python interface to Graphviz. +A Python interface to Graphviz. """ -# Copyright (C) 2006-2011 by +# Copyright (C) 2006-2011 by # Aric Hagberg # Dan Schult # Manos Renieris, http://www.cs.brown.edu/~er/ -# Distributed with BSD license. +# Distributed with BSD license. # All rights reserved, see LICENSE for details. import re +import shlex import subprocess import sys import threading @@ -30,7 +31,7 @@ class PipeReader(threading.Thread): """Read and write pipes using threads. - """ + """ def __init__(self, result, pipe): threading.Thread.__init__(self) self.result = result @@ -52,35 +53,35 @@ class AGraph(object): """Class for Graphviz agraph type. - + Example use - + >>> from pygraphviz import * - >>> G=AGraph() + >>> G=AGraph() >>> G=AGraph(directed=True) - >>> G=AGraph("file.dot") # doctest: +SKIP - + >>> G=AGraph("file.dot") # doctest: +SKIP + Graphviz graph keyword parameters are processed so you may add them like - + >>> G=AGraph(landscape='true',ranksep='0.1') - + or alternatively - + >>> G=AGraph() >>> G.graph_attr.update(landscape='true',ranksep='0.1') - + and - + >>> G.node_attr.update(color='red') >>> G.edge_attr.update(len='2.0',color='blue') - + See http://www.graphviz.org/doc/info/attrs.html for a list of attributes. Keyword parameters: - thing is a generic input type (filename, string, handle to pointer, + thing is a generic input type (filename, string, handle to pointer, dictionary of dictionaries). An attempt is made to automaticaly detect the type so you may write for example: @@ -91,9 +92,9 @@ >>> h=B.handle >>> C=AGraph(h) - Parameters:: + Parameters:: - name: Name for the graph + name: Name for the graph strict: True|False (True for simple graphs) @@ -107,13 +108,13 @@ handle: Swig pointer to an agraph_t data structure """ - def __init__(self, thing=None, + def __init__(self, thing=None, filename=None, data=None, string=None, handle=None, name='', strict=True, directed=False, **attr): self.handle=None # assign first in case the __init__ bombs # initialization can take no arguments (gives empty graph) or # a file name - # a string of graphviz dot language + # a string of graphviz dot language # a swig pointer (handle) to a graph # a dict of dicts (or dict of lists) data structure @@ -130,7 +131,7 @@ data=thing # a dictionary of dictionaries (or lists) elif hasattr(thing,'own'): # a Swig pointer - graph handle handle=thing - elif self._is_string_like(thing): + elif self._is_string_like(thing): pattern=re.compile('(strict)?\s*(graph|digraph).*{.*}\s*', re.DOTALL) if pattern.match(thing): @@ -148,7 +149,7 @@ self.read(filename) elif string is not None: # load new graph from string (creates self.handle) - # get the charset from the string to properly encode it for + # get the charset from the string to properly encode it for # writing to the temporary file in from_string() match = re.search(r'charset\s*=\s*"([^"]+)"', string) if match is not None: @@ -157,12 +158,12 @@ self.encoding = _DEFAULT_ENCODING self.from_string(string) else: - # no handle, need to + # no handle, need to self.handle = None if self.handle is not None: - # the handle was specified or created - # get the encoding from the "charset" graph attribute + # the handle was specified or created + # get the encoding from the "charset" graph attribute item=gv.agget(self.handle,'charset') if item is not None: self.encoding = item @@ -173,6 +174,8 @@ # get encoding from the "charset" kwarg self.encoding = attr.get('charset', _DEFAULT_ENCODING) try: + if name is None: + name = '' # instantiate a new, empty graph self.handle=gv.agraphnew(name.encode(self.encoding), strict,directed) @@ -190,7 +193,7 @@ for node in data: for nbr in data[node]: self.add_edge(node,nbr) - self.add_nodes_from(data.keys()) + self.add_nodes_from(data.keys()) # throw away the charset attribute, if one exists, # since we've already set it, and now it should not be changed @@ -203,7 +206,7 @@ self.node_attr=Attribute(self.handle,1) # default node attributes self.edge_attr=Attribute(self.handle,2) # default edge attribtes - def __str__(self): + def __str__(self): return unicode(self).encode(self.encoding,'replace') def __unicode__(self): @@ -212,8 +215,8 @@ def __repr__(self): name=gv.agnameof(self.handle) if name is None: - return '' %(self.handle) - return '' %(name,self.handle) + return '' %(self.handle) + return '' %(name,self.handle) def __eq__(self,other): # two graphs are equal if they have exact same string representation @@ -232,7 +235,7 @@ def __contains__(self,n): # provide "n in G" return self.has_node(n) - + def __len__(self): return self.number_of_nodes() @@ -266,7 +269,7 @@ >>> G.add_node(1) # will be converted to a string >>> G.nodes() [u'a', u'1'] - + Attributes can be added to nodes on creation (attribute values must be strings) @@ -278,7 +281,7 @@ Anonymous Graphviz nodes are currently not implemented. """ - if not self._is_string_like(n): + if not self._is_string_like(n): n=str(n) n=n.encode(self.encoding) try: @@ -298,7 +301,7 @@ >>> G.add_nodes_from(nlist) >>> sorted(G.nodes()) [u'1', u'a', u'b', u'spam'] - + Attributes can be added to nodes on creation @@ -313,13 +316,13 @@ Attempting to remove a node that isn't in the graph will produce an error. - + >>> G=AGraph() >>> G.add_node('a') >>> G.remove_node('a') """ - if not self._is_string_like(n): + if not self._is_string_like(n): n=str(n) n=n.encode(self.encoding) try: @@ -340,7 +343,7 @@ >>> G.add_nodes_from(nlist) >>> G.remove_nodes_from(nlist) """ - for n in nbunch: + for n in nbunch: self.remove_node(n) delete_nodes_from=remove_nodes_from @@ -400,7 +403,7 @@ """ return Node(self,n) - def add_edge(self,u,v=None,key=None,**attr): + def add_edge(self,u,v=None,key=None,**attr): """Add a single edge between nodes u and v. If the nodes u and v are not in the graph they will added. @@ -408,7 +411,7 @@ If u and v are not strings, conversion to a string will be attempted. String conversion will work if u and v have valid string representation (try str(u) if you are unsure). - + >>> G=AGraph() >>> G.add_edge('a','b') >>> G.edges() @@ -447,7 +450,7 @@ vh=Node(self,v).handle try: if key is not None: - if not self._is_string_like(key): + if not self._is_string_like(key): key=str(key) key=key.encode(self.encoding) eh=gv.agedge(self.handle,uh,vh,key,_Action.create) @@ -456,7 +459,7 @@ except KeyError: return None # silent failure for strict graph, already added - def add_edges_from(self, ebunch, **attr): + def add_edges_from(self, ebunch, **attr): """Add nodes to graph from a container ebunch. ebunch is a container of edges such as a list or dictionary. @@ -495,7 +498,7 @@ matching (u,v,key). """ - if v is None: + if v is None: (u,v)=u # no v given, assume u is an edge tuple e=Edge(self,u,v,key) try: @@ -503,9 +506,9 @@ except KeyError: raise KeyError("Edge %s-%s not in graph."%(u,v)) - delete_edge=remove_edge + delete_edge=remove_edge - def remove_edges_from(self, ebunch): + def remove_edges_from(self, ebunch): """Remove edges from ebunch (a container of edges).""" for e in ebunch: self.remove_edge(e) @@ -519,12 +522,12 @@ >>> G.add_edge('a','b') >>> G.has_edge('a','b') True - + Optional key argument will restrict match to edges (u,v,key). """ - if v is None: + if v is None: (u,v)=u # no v given, assume u is an edge tuple try: Edge(self,u,v,key) @@ -537,7 +540,7 @@ If the optional nbunch (container of nodes) only edges adjacent to nodes in nbunch will be returned. - + >>> G=AGraph() >>> G.add_edge('a','b') >>> G.add_edge('c','d') @@ -609,7 +612,7 @@ yield e eh=gv.agnxtout(self.handle,eh) nh=gv.agnxtnode(self.handle,nh) - elif nbunch in self: # if nbunch is a single node + elif nbunch in self: # if nbunch is a single node n=Node(self,nbunch) nh=n.handle eh=gv.agfstout(self.handle,nh) @@ -625,7 +628,7 @@ except TypeError: raise TypeError("nbunch is not a node or a sequence of nodes.") for n in nbunch: - try: + try: nh=Node(self,n).handle except KeyError: continue @@ -638,7 +641,7 @@ yield e eh=gv.agnxtout(self.handle,eh) raise StopIteration - + iteroutedges=out_edges_iter iteredges=out_edges_iter @@ -665,7 +668,7 @@ yield e eh=gv.agnxtin(self.handle,eh) nh=gv.agnxtnode(self.handle,nh) - elif nbunch in self: # if nbunch is a single node + elif nbunch in self: # if nbunch is a single node n=Node(self,nbunch) nh=n.handle eh=gv.agfstin(self.handle,nh) @@ -681,7 +684,7 @@ except TypeError: raise TypeError("nbunch is not a node or a sequence of nodes.") for n in nbunch: - try: + try: nh=Node(self,n).handle except KeyError: continue @@ -700,7 +703,7 @@ # define edges to be out_edges implicitly since edges uses edges_iter edges_iter=out_edges_iter - + def out_edges(self, nbunch=None, keys=False): """Return list of out edges in the graph. @@ -721,7 +724,7 @@ """Return iterator over predecessor nodes of n. Note: modifying the graph structure while iterating over - node predecessors may produce unpredictable results. Use + node predecessors may produce unpredictable results. Use predecessors() as an alternative. """ n=Node(self,n) @@ -743,7 +746,7 @@ """Return iterator over successor nodes of n. Note: modifying the graph structure while iterating over - node successors may produce unpredictable results. Use + node successors may produce unpredictable results. Use successors() as an alternative. """ n=Node(self,n) @@ -769,20 +772,20 @@ """Return list of predecessor nodes of n.""" return list(self.predecessors_iter(n)) - # digraph definitions + # digraph definitions out_neighbors=successors in_neighbors=predecessors def degree_iter(self,nbunch=None,indeg=True,outdeg=True): """Return an iterator over the degree of the nodes given in - nbunch container. + nbunch container. - Returns paris of (node,degree). + Returns paris of (node,degree). """ # prepare nbunch if nbunch is None: # include all nodes via iterator bunch=[n for n in self.nodes_iter()] - elif nbunch in self: # if nbunch is a single node + elif nbunch in self: # if nbunch is a single node bunch=[Node(self,nbunch)] else: # if nbunch is a sequence of nodes try: bunch=[Node(self,n) for n in nbunch if n in self] @@ -796,7 +799,7 @@ """Return an iterator over the in-degree of the nodes given in nbunch container. - Returns paris of (node,degree). + Returns paris of (node,degree). """ return self.degree_iter(nbunch,indeg=True,outdeg=False) @@ -804,7 +807,7 @@ """Return an iterator over the out-degree of the nodes given in nbunch container. - Returns paris of (node,degree). + Returns paris of (node,degree). """ return self.degree_iter(nbunch,indeg=False,outdeg=True) @@ -814,7 +817,7 @@ def out_degree(self,nbunch=None, with_labels=False): """Return the out-degree of nodes given in nbunch container. - + Using optional with_labels=True returns a dictionary keyed by node with value set to the degree. """ @@ -830,7 +833,7 @@ def in_degree(self,nbunch=None, with_labels=False): """Return the in-degree of nodes given in nbunch container. - + Using optional with_labels=True returns a dictionary keyed by node with value set to the degree. """ @@ -844,12 +847,12 @@ else: return dlist - + def reverse(self): """Return copy of directed graph with edge directions reversed.""" if self.directed: # new empty DiGraph - H=self.__class__(strict=self.strict,directed=True) + H=self.__class__(strict=self.strict,directed=True,name=self.name) H.graph_attr.update(self.graph_attr) H.node_attr.update(self.node_attr) H.edge_attr.update(self.edge_attr) @@ -869,7 +872,7 @@ def degree(self,nbunch=None,with_labels=False): """Return the degree of nodes given in nbunch container. - + Using optional with_labels=True returns a dictionary keyed by node with value set to the degree. @@ -883,8 +886,8 @@ else: return dlist - iterdegree=degree_iter - + iterdegree=degree_iter + def number_of_edges(self): """Return the number of edges in the graph.""" return gv.agnedges(self.handle) @@ -903,8 +906,8 @@ name=gv.agnameof(self.handle) strict=self.strict directed=self.directed - gv.agclose(self.handle) - self.handle=gv.agraphnew(name,strict,directed) + gv.agclose(self.handle) + self.handle=gv.agraphnew(name,strict,directed) def close(self): # may be useful to clean up graphviz data @@ -937,13 +940,13 @@ def add_cycle(self, nlist): """Add the cycle of nodes given in nlist.""" - self.add_path(nlist+[nlist[0]]) + self.add_path(nlist+[nlist[0]]) def prepare_nbunch(self,nbunch=None): # private function to build bunch from nbunch if nbunch is None: # include all nodes via iterator bunch=self.nodes_iter() - elif nbunch in self: # if nbunch is a single node + elif nbunch in self: # if nbunch is a single node bunch=[Node(self,nbunch)] else: # if nbunch is a sequence of nodes try: # capture error for nonsequence/iterator entries. @@ -973,23 +976,23 @@ bunch=self.prepare_nbunch(nbunch) H.add_nodes_from(bunch) for (u,v) in self.edges(): - if u in H and v in H: + if u in H and v in H: H.add_edge(u,v) return H def remove_subgraph(self, name): - """Remove subgraph with given name.""" + """Remove subgraph with given name.""" try: handle=gv.agsubg(self.handle,name.encode(self.encoding), _Action.find) except TypeError: raise TypeError("Subgraph name must be a string: %s"%name) - if handle is None: + if handle is None: raise KeyError("Subgraph %s not in graph."%name) gv.agdelsubg(self.handle,handle) - + delete_subgraph=remove_subgraph subgraph=add_subgraph @@ -998,25 +1001,25 @@ """Return parent graph of subgraph or None if graph is root graph. """ handle=gv.agparent(self.handle) - if handle is None: + if handle is None: return None H=self.__class__(strict=self.strict, directed=self.directed, handle=handle, name=name) return H - + def subgraph_root(self, nbunch=None, name=None): """Return root graph of subgraph or None if graph is root graph. """ handle=gv.agroot(self.handle) - if handle is None: + if handle is None: return None H=self.__class__(strict=self.strict, directed=self.directed, handle=handle,name=name) return H - + def get_subgraph(self,name): """Return existing subgraph with specified name or None if it doesn't exist. @@ -1027,13 +1030,13 @@ except TypeError: raise TypeError("Subgraph name must be a string: %s"%name) - if handle is None: + if handle is None: return None H=self.__class__(strict=self.strict, directed=self.directed, handle=handle) return H - + def subgraphs_iter(self): """Iterator over subgraphs.""" handle=gv.agfstsubg(self.handle) @@ -1061,7 +1064,7 @@ else: return False - strict=property(is_strict) + strict=property(is_strict) def is_directed(self): """Return True if graph is directed or False if not.""" @@ -1128,10 +1131,10 @@ else: return self.copy() - # io + # io def read(self, path): """Read graph from dot format file on path. - + path can be a file name or file handle use:: @@ -1140,14 +1143,14 @@ """ fh=self._get_fh(path) - try: + try: self.handle = gv.agread(fh,None) except IOError: print "IO error reading file" def write(self, path=None): """Write graph in dot format to file on path. - + path can be a file name or file handle use:: @@ -1157,20 +1160,20 @@ if path is None: path=sys.stdout fh=self._get_fh(path,'w') - try: + try: gv.agwrite(self.handle,fh) except IOError: print "IO error writing file" def string_nop(self): - """Return a string (unicode) representation of graph in dot format.""" + """Return a string (unicode) representation of graph in dot format.""" # this will fail for graphviz-2.8 because of a broken nop # so use tempfile version below return self.draw(format='dot',prog='nop').decode(self.encoding) def to_string(self): - """Return a string (unicode) representation of graph in dot format.""" + """Return a string (unicode) representation of graph in dot format.""" from tempfile import TemporaryFile fh = TemporaryFile() # Cover TemporaryFile wart: on 'nt' we need the file member @@ -1184,7 +1187,7 @@ return data.decode(self.encoding) def string(self): - """Return a string (unicode) represetnation of graph in dot format.""" + """Return a string (unicode) represetnation of graph in dot format.""" # return self.to_string() return self.string_nop() @@ -1192,9 +1195,9 @@ """Load a graph from a string in dot format. Overwrites any existing graph. - + To make a new graph from a string use - + >>> s='digraph {1 -> 2}' >>> A=AGraph() >>> t=A.from_string(s) @@ -1228,30 +1231,31 @@ p=gvprogs[prog] except KeyError: raise ValueError("Program %s is not one of: %s."%\ - (prog,', '.join(gvprogs.keys()))) - + (prog,', '.join(gvprogs.keys()))) + try: # user must pick one of the graphviz programs... runprog = self._which(prog) except: - raise ValueError("Program %s not found in path."%prog) + raise ValueError("Program %s not found in path."%prog) return runprog def _run_prog(self,prog='nop',args=''): """Apply graphviz program to graph and return the result as a string. >>> A=AGraph() - >>> s=A._run_prog() # doctest: +SKIP - >>> s=A._run_prog(prog='acyclic') # doctest: +SKIP + >>> s=A._run_prog() # doctest: +SKIP + >>> s=A._run_prog(prog='acyclic') # doctest: +SKIP Use keyword args to add additional arguments to graphviz programs. """ - runprog=self._get_prog(prog) + runprog=r'"%s"'%self._get_prog(prog) cmd=' '.join([runprog,args]) - p = subprocess.Popen(cmd, - shell=True, - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + dotargs = shlex.split(cmd) + p = subprocess.Popen(dotargs, + shell=False, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, close_fds=False) (child_stdin, child_stdout, @@ -1281,12 +1285,12 @@ def layout(self,prog='neato',args=''): """Assign positions to nodes in graph. - + Optional prog=['neato'|'dot'|'twopi'|'circo'|'fdp'|'nop'] will use specified graphviz layout method. >>> A=AGraph() - >>> A.layout() # uses neato + >>> A.layout() # uses neato >>> A.layout(prog='dot') Use keyword args to add additional arguments to graphviz programs. @@ -1306,11 +1310,11 @@ def tred(self,args='',copy=False): """Transitive reduction of graph. Modifies existing graph. - - To create a new graph use + + To create a new graph use >>> A=AGraph() - >>> B=A.tred(copy=True) # doctest: +SKIP + >>> B=A.tred(copy=True) # doctest: +SKIP See the graphviz "tred" program for details of the algorithm. """ @@ -1325,10 +1329,10 @@ """Reverse sufficient edges in digraph to make graph acyclic. Modifies existing graph. - To create a new graph use + To create a new graph use >>> A=AGraph() - >>> B=A.acyclic(copy=True) # doctest: +SKIP + >>> B=A.acyclic(copy=True) # doctest: +SKIP See the graphviz "acyclic" program for details of the algorithm. """ @@ -1343,14 +1347,14 @@ """Output graph to path in specified format. An attempt will be made to guess the output format based on the file - extension of `path`. If that fails, then the `format` parameter will + extension of `path`. If that fails, then the `format` parameter will be used. - Note, if `path` is a file object returned by a call to os.fdopen(), - then the method for discovering the format will not work. In such - cases, one should explicitly set the `format` parameter; otherwise, it + Note, if `path` is a file object returned by a call to os.fdopen(), + then the method for discovering the format will not work. In such + cases, one should explicitly set the `format` parameter; otherwise, it will default to 'dot'. - + Formats (not all may be available on every system depending on how Graphviz was built) @@ -1364,7 +1368,7 @@ If prog is not specified and the graph has positions (see layout()) then no additional graph positioning will be performed. - + Optional prog=['neato'|'dot'|'twopi'|'circo'|'fdp'|'nop'] will use specified graphviz layout method. @@ -1375,7 +1379,7 @@ >>> G.draw('file.ps') # use dot to position, output png in 'file' - >>> G.draw('file', format='png',prog='dot') + >>> G.draw('file', format='png',prog='dot') # use keyword 'args' to pass additional arguments to graphviz >>> G.draw('test.ps',prog='twopi',args='-Gepsilon=1') @@ -1388,7 +1392,7 @@ # try to guess format from extension if format is None and path is not None: fh=self._get_fh(path,'w+b') - format=os.path.splitext(fh.name)[-1].lower()[1:] + format=os.path.splitext(fh.name)[-1].lower()[1:] if format is None or format=='': format = 'dot' @@ -1476,7 +1480,7 @@ match=glob.glob(os.path.join(path, name+exe)) if match: return match[0] - raise ValueError("No prog %s in path."%name) + raise ValueError("No prog %s in path."%name) @@ -1501,13 +1505,13 @@ >>> node=G.get_node(1) The node object is derived from a string and can be manipulated as such. - + Each node has attributes that can be directly accessed through the attr dictionary: >>> node.attr['color']='red' - """ + """ def __new__(self,graph,name=None,nh=None): if nh is not None: n=unicode.__new__(self,gv.agnameof(nh),graph.encoding) @@ -1517,7 +1521,7 @@ nh=gv.agnode(graph.handle,n.encode(graph.encoding),_Action.find) except KeyError: raise KeyError("Node %s not in graph."%n) - + n.ghandle=graph.handle n.attr=ItemAttribute(nh,1) n.handle=nh @@ -1525,9 +1529,9 @@ return n def get_handle(self): - """Return pointer to graphviz node object.""" + """Return pointer to graphviz node object.""" return gv.agnode(self.ghandle,self.encode(self.encoding),_Action.find) - + # handle=property(get_handle) def get_name(self): @@ -1546,7 +1550,7 @@ >>> G=AGraph() - then + then >>> G.add_edge(1,2) @@ -1566,20 +1570,20 @@ The edge is represented as a tuple (u,v) or (u,v,key) and can be manipulated as such. - + Each edge has attributes that can be directly accessed through the attr dictionary: >>> edge.attr['color']='red' - """ + """ def __new__(self,graph,source=None,target=None,key=None,eh=None): - # edge handle given, reconstruct node object + # edge handle given, reconstruct node object if eh is not None: (source,target)=(gv.agtail(eh),gv.aghead(eh)) s=Node(graph,nh=source) t=Node(graph,nh=target) - # no edge handle, search for edge and construct object + # no edge handle, search for edge and construct object else: s=Node(graph,source) t=Node(graph,target) @@ -1623,13 +1627,13 @@ >>> G.graph_attr['splines']='true' >>> G.node_attr['shape']='circle' >>> G.edge_attr['color']='red' - + See http://graphviz.org/doc/info/attrs.html for a list of all attributes. """ - # use for graph, node, and edge default attributes + # use for graph, node, and edge default attributes # atype:graph=0, node=1,edge=3 def __init__(self,handle,atype): self.handle=handle @@ -1638,7 +1642,7 @@ ghandle=gv.agraphof(handle) root_handle=gv.agroot(ghandle) # get root graph try: - ah=gv.agattr(root_handle,0,'charset',None) + ah=gv.agattr(root_handle,0,'charset',None) self.encoding=gv.agattrdefval(ah) except KeyError: self.encoding=_DEFAULT_ENCODING @@ -1646,7 +1650,7 @@ def __setitem__(self, name, value): if name == 'charset' and self.type == 0: raise ValueError('Graph charset is immutable!') - if not is_string_like(value): + if not is_string_like(value): value=str(value) ghandle=gv.agroot(self.handle) # get root graph if ghandle==self.handle: @@ -1664,7 +1668,7 @@ if item is None: ah=gv.agattr(self.handle,self.type, name.encode(self.encoding), - None) + None) item=gv.agattrdefval(ah) return item.decode(self.encoding) @@ -1698,19 +1702,19 @@ except KeyError: # gv.agattrdefval returned KeyError, skip continue -class ItemAttribute(Attribute): +class ItemAttribute(Attribute): """Attributes for individual nodes and edges. Assigned on initialization of Node or Edge classes and manipulated through the class data. - >>> G=AGraph() + >>> G=AGraph() >>> G.add_edge('a','b') >>> n=Node(G,'a') >>> n.attr['shape']='circle' >>> e=Edge(G,'a','b') >>> e.attr['color']='red' - + See http://graphviz.org/doc/info/attrs.html for a list of all attributes. @@ -1724,13 +1728,13 @@ # get the encoding root_handle=gv.agroot(self.ghandle) # get root graph try: - ah=gv.agattr(root_handle,0,'charset',None) + ah=gv.agattr(root_handle,0,'charset',None) self.encoding=gv.agattrdefval(ah) except KeyError: self.encoding=_DEFAULT_ENCODING def __setitem__(self, name, value): - if not is_string_like(value): + if not is_string_like(value): value=str(value) if self.type==1 and name=='label': default='\N' @@ -1754,11 +1758,11 @@ ah=None while 1: try: - ah=gv.agnxtattr(self.ghandle,self.type,ah) + ah=gv.agnxtattr(self.ghandle,self.type,ah) value=gv.agxget(self.handle,ah) - try: + try: defval=gv.agattrdefval(ah) # default value - if defval==value: + if defval==value: continue # don't report default except: # no default, gv.getattrdefval raised error pass @@ -1767,7 +1771,7 @@ value.decode(self.encoding)) except KeyError: # gv.agxget returned KeyError, skip continue - + def _test_suite(): @@ -1792,4 +1796,3 @@ nxbase=sys.path[0]+os.sep+os.pardir sys.path.insert(0,nxbase) # prepend to search path unittest.TextTestRunner().run(_test_suite()) - diff -Nru python-pygraphviz-1.1/pygraphviz/release.py python-pygraphviz-1.2/pygraphviz/release.py --- python-pygraphviz-1.1/pygraphviz/release.py 2011-05-14 18:12:14.000000000 +0000 +++ python-pygraphviz-1.2/pygraphviz/release.py 2013-08-03 15:57:19.000000000 +0000 @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- """Release data for PyGraphviz.""" -# Copyright (C) 2006-2011 by -# Aric Hagberg +# Copyright (C) 2006-2013 by +# Aric Hagberg # Dan Schult # Manos Renieris, http://www.cs.brown.edu/~er/ # Distributed with BSD license. @@ -63,7 +63,7 @@ return None name = 'pygraphviz' -version = '1.1' +version = '1.2' # Declare current release as a development release. # Change to False before tagging a release; then change back. @@ -78,16 +78,16 @@ description = "Python interface to Graphviz" long_description = """\ -PyGraphviz is a Python interface to the Graphviz graph layout and visualization package. With PyGraphviz you can create, edit, read, write, and draw graphs using Python to access the Graphviz graph data structure and layout algorithms. PyGraphviz is independent from NetworkX but provides a similar programming interface. +PyGraphviz is a Python interface to the Graphviz graph layout and visualization package. With PyGraphviz you can create, edit, read, write, and draw graphs using Python to access the Graphviz graph data structure and layout algorithms. PyGraphviz provides a similar programming interface to NetworkX (http://networkx.github.io). """ license = 'BSD' -authors = {'Hagberg' : ('Aric Hagberg','hagberg@lanl.gov'), +authors = {'Hagberg' : ('Aric Hagberg','aric.hagberg@gmail.com'), 'Schult' : ('Dan Schult','dschult@colgate.edu'), 'Renieris' : ('Manos Renieris','') } -url = 'http://networkx.lanl.gov/pygraphviz' -download_url="http://networkx.lanl.gov/download/pygraphviz" +url = 'http://pygraphviz.github.io' +download_url="https://pypi.python.org/pypi/pygraphviz" platforms = ['Linux','Mac OSX'] keywords = ['Networks', 'Graph Visualization', 'network', 'graph', 'graph drawing'] classifiers = [ diff -Nru python-pygraphviz-1.1/pygraphviz/tests/graph.txt python-pygraphviz-1.2/pygraphviz/tests/graph.txt --- python-pygraphviz-1.1/pygraphviz/tests/graph.txt 2011-05-14 18:12:13.000000000 +0000 +++ python-pygraphviz-1.2/pygraphviz/tests/graph.txt 2013-08-03 15:57:19.000000000 +0000 @@ -510,3 +510,6 @@ >>> A=AGraph(name='test') >>> A.name u'test' +>>> B=A.reverse() +>>> B.name +u'test' diff -Nru python-pygraphviz-1.1/pygraphviz/version.py python-pygraphviz-1.2/pygraphviz/version.py --- python-pygraphviz-1.1/pygraphviz/version.py 2011-05-14 18:12:14.000000000 +0000 +++ python-pygraphviz-1.2/pygraphviz/version.py 2013-08-03 15:57:44.000000000 +0000 @@ -5,7 +5,7 @@ """ -__version__ = '1.1' +__version__ = '1.2' __revision__ = None -__date__ = 'Sat May 14 12:12:14 2011' +__date__ = 'Sat Aug 3 09:57:44 2013' diff -Nru python-pygraphviz-1.1/setup.py python-pygraphviz-1.2/setup.py --- python-pygraphviz-1.1/setup.py 2011-05-14 18:12:14.000000000 +0000 +++ python-pygraphviz-1.2/setup.py 2013-08-03 15:57:19.000000000 +0000 @@ -3,8 +3,8 @@ """ Setup script for PyGraphviz """ -# Copyright (C) 2006-2010 by -# Aric Hagberg +# Copyright (C) 2006-2013 by +# Aric Hagberg # Dan Schult # Manos Renieris, http://www.cs.brown.edu/~er/ # Distributed with BSD license.