Commit 17be21ec authored by SVN-Git Migration's avatar SVN-Git Migration

Imported Upstream version 1.7.1

parent b78ca145
......@@ -3,6 +3,22 @@ Changes
.. currentmodule:: objgraph
1.7.1 (2011-12-11)
------------------
- Bugfix: non-ASCII characters in object representations would break graph
generation on Python 3.x, in some locales (e.g. with LC_ALL=C). Reported and
fixed by `Stefano Rivera <https://launchpad.net/~stefanor>`_.
- Bugfix: setup.py was broken on Python 3.x
- Bugfix: dot.exe/xdot.exe were not found on Windows (`LP#767239
<http://launchpad.net/bugs/767239>`_).
- Documentation updates: document the forgotten :func:`find_ref_chain`,
update :func:`show_chain` prototype.
1.7.0 (2011-03-11)
------------------
......
......@@ -43,9 +43,18 @@ An easy way to get Pythons 2.4 through 2.7 (and 3.1) on Ubuntu is to use Felix
Krull's "`deadsnakes <https://launchpad.net/~fkrull/+archive/deadsnakes>`_"
PPA::
sudo add-apt-repository ppa:~fkrull/deadsnakes
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python2.{4,5,6,7} python3.1
Python 3.2 is not available there at the time of this writing, but there's
a `Python 3.2 PPA <https://launchpad.net/~irie/+archive/python3.2>`_ by IRIE
Shinsuke::
sudo add-apt-repository ppa:irie/python3.2
sudo apt-get update
sudo apt-get install python3.2
Test coverage
-------------
......@@ -87,10 +96,15 @@ of the images include things like memory addresses which tend to change from
run to run.)
`imgdiff <http://pypi.python.org/pypi/imgdiff>`_ is useful for comparing the
images with older versions::
images with their older versions::
bzr diff --using imgdiff *.png
It has a few options that may make the changes easier to see. I personally
like::
bzr diff --using "imgdiff -H --eog" *.png
When you add a new doctest file, remember to include it in ``docs/index.txt``.
When you add a new function, make sure it has a `PEP-257
......@@ -109,7 +123,8 @@ preceded by a blank line. Example::
If Emacs is broken, fix emacs, do not make my docstrings ugly.
On the other hand, if the last thing in a docstring is an indented block
quote/doctest section, it should be surrounded by blank lines. Like this::
quote or a doctest section, it should be surrounded by blank lines. Like
this::
def do_something():
"""Do something.
......
......@@ -61,7 +61,7 @@ dist:
distcheck:
# Bit of a chicken-and-egg here, but if the tree is unclean, make
# distcheck will fail. Thankfully bzr lets me uncommit.
@test -z "`bzr status 2>&1`" || { echo; echo "Your working tree is not clean" 1>&2; bzr status; exit 1; }
@test -z "`bzr status 2>&1|grep -v 'shelves exist'`" || { echo; echo "Your working tree is not clean" 1>&2; bzr status; exit 1; }
make dist
pkg_and_version=`$(PYTHON) setup.py --name`-`$(PYTHON) setup.py --version` && \
rm -rf tmp && \
......@@ -102,9 +102,13 @@ release: releasechecklist
@echo " make test-all-pythons"
@echo " make clean images docs"
@echo
@echo "about now. Then commit the new images and run"
@echo "about now. Then sanity-check the images with"
@echo
@echo " $(PYTHON) setup.py sdist register upload && bzr tag `$(PYTHON) setup.py --version`"
@echo " bzr diff --using=imgdiff --diff-options='-H --eog'"
@echo
@echo "then either revert or commit the new images and run"
@echo
@echo " $(PYTHON) setup.py sdist register upload --unicode-description && bzr tag `$(PYTHON) setup.py --version`"
@echo " make publish-docs"
@echo
@echo "Please increment the version number in $(FILE_WITH_VERSION)"
......@@ -119,6 +123,7 @@ publish-docs:
echo "There's no ~/www/objgraph, do you have the website checked out?"; exit 1; }
make clean docs
cp -r docs/_build/html/* ~/www/objgraph/
svn add ~/www/objgraph/*.html ~/www/objgraph/_images/*.png 2>/dev/null
svn st ~/www/objgraph/
@echo
@echo "If everything looks fine, please run"
......
Metadata-Version: 1.0
Name: objgraph
Version: 1.7.0
Version: 1.7.1
Summary: Draws Python object reference graphs with graphviz
Home-page: http://mg.pov.lt/objgraph/
Author: Marius Gedminas
......@@ -65,6 +65,22 @@ Description: Python Object Graphs
1.7.1 (2011-12-11)
------------------
- Bugfix: non-ASCII characters in object representations would break graph
generation on Python 3.x, in some locales (e.g. with LC_ALL=C). Reported and
fixed by `Stefano Rivera <https://launchpad.net/~stefanor>`_.
- Bugfix: setup.py was broken on Python 3.x
- Bugfix: dot.exe/xdot.exe were not found on Windows (`LP#767239
<http://launchpad.net/bugs/767239>`_).
- Documentation updates: document the forgotten `find_ref_chain`,
update `show_chain` prototype.
1.7.0 (2011-03-11)
------------------
......@@ -73,7 +89,7 @@ Description: Python Object Graphs
- New ``backrefs`` argument for `show_chain`.
- New function: `get_leaking_objects`, based on `a blog post by
Kristján Valur
Kristjan Valur
<http://blog.ccpgames.com/kristjan/2010/12/08/finding-c-reference-leaks-using-the-gc-module/>`_.
- New ``objects`` argument for `count`, `typestats`,
......
......@@ -33,9 +33,11 @@ Locating and Filtering Objects
Traversing and Displaying Object Graphs
---------------------------------------
.. autofunction:: find_ref_chain(obj, predicate[, max_depth=20, extra_ignore=()])
.. autofunction:: find_backref_chain(obj, predicate[, max_depth=20, extra_ignore=()])
.. autofunction:: show_chain
.. autofunction:: show_chain(chain[, ..., highlight=None, filename=None, extra_info=None, refcounts=False])
.. autofunction:: show_backrefs(objs[, max_depth=3, extra_ignore=(), filter=None, too_many=10, highlight=None, filename=None, extra_info=None, refcounts=False])
......
Metadata-Version: 1.0
Name: objgraph
Version: 1.7.0
Version: 1.7.1
Summary: Draws Python object reference graphs with graphviz
Home-page: http://mg.pov.lt/objgraph/
Author: Marius Gedminas
......@@ -65,6 +65,22 @@ Description: Python Object Graphs
1.7.1 (2011-12-11)
------------------
- Bugfix: non-ASCII characters in object representations would break graph
generation on Python 3.x, in some locales (e.g. with LC_ALL=C). Reported and
fixed by `Stefano Rivera <https://launchpad.net/~stefanor>`_.
- Bugfix: setup.py was broken on Python 3.x
- Bugfix: dot.exe/xdot.exe were not found on Windows (`LP#767239
<http://launchpad.net/bugs/767239>`_).
- Documentation updates: document the forgotten `find_ref_chain`,
update `show_chain` prototype.
1.7.0 (2011-03-11)
------------------
......@@ -73,7 +89,7 @@ Description: Python Object Graphs
- New ``backrefs`` argument for `show_chain`.
- New function: `get_leaking_objects`, based on `a blog post by
Kristján Valur
Kristjan Valur
<http://blog.ccpgames.com/kristjan/2010/12/08/finding-c-reference-leaks-using-the-gc-module/>`_.
- New ``objects`` argument for `count`, `typestats`,
......
......@@ -29,10 +29,11 @@ Released under the MIT licence.
__author__ = "Marius Gedminas (marius@gedmin.as)"
__copyright__ = "Copyright (c) 2008-2011 Marius Gedminas"
__license__ = "MIT"
__version__ = "1.7.0"
__date__ = "2011-03-11"
__version__ = "1.7.1"
__date__ = "2011-12-11"
import codecs
import gc
import re
import inspect
......@@ -508,11 +509,16 @@ def show_graph(objs, edge_func, swap_source_target,
if not isinstance(objs, (list, tuple)):
objs = [objs]
if filename and filename.endswith('.dot'):
f = open(filename, 'w')
f = codecs.open(filename, 'w', encoding='utf-8')
dot_filename = filename
else:
fd, dot_filename = tempfile.mkstemp('.dot', text=True)
f = os.fdopen(fd, "w")
if f.encoding != None:
# Python 3 will wrap the file in the user's preferred encoding
# Re-wrap it for utf-8
import io
f = io.TextIOWrapper(f.detach(), 'utf-8')
f.write('digraph ObjectGraph {\n'
' node[shape=box, style=filled, fillcolor=white];\n')
queue = []
......@@ -737,5 +743,6 @@ is_identifier = re.compile('[a-zA-Z_][a-zA-Z_0-9]*$').match
def program_in_path(program):
path = os.environ.get("PATH", os.defpath).split(os.pathsep)
path = [os.path.join(dir, program) for dir in path]
path = [True for file in path if os.path.isfile(file)]
path = [True for file in path
if os.path.isfile(file) or os.path.isfile(file + '.exe')]
return bool(path)
#!/usr/bin/python
import os, re, sys, unittest, doctest
import codecs, os, re, sys, unittest, doctest
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setuptools_options = {}
else:
setuptools_options = dict(
test_suite='tests.test_suite',
)
try:
unichr
except NameError:
# Python 3.x support
unichr = chr
def relative(filename):
......@@ -13,7 +24,7 @@ def relative(filename):
def read(filename):
f = open(relative(filename))
f = codecs.open(relative(filename), 'r', 'utf-8')
try:
return f.read()
finally:
......@@ -37,7 +48,15 @@ def get_version():
def get_description():
readme = read('README.txt')
changelog = read('CHANGES.txt')
return unsphinx(readme + '\n\n\n' + changelog)
description = unsphinx(readme + '\n\n\n' + changelog)
if '--unicode-description' in sys.argv:
sys.argv.remove('--unicode-description')
else:
# can't use u'' literals, this is supposed to work on both Py2 and Py3
description = description.replace('Kristj%sn' % unichr(0xe1),
'Kristjan')
description = description.encode('ascii', 'replace').decode('ascii')
return description
def build_images(doctests=()):
......@@ -80,4 +99,5 @@ setup(name='objgraph',
'Programming Language :: Python :: 3.1',
'Programming Language :: Python :: 3.2',
],
py_modules=['objgraph'])
py_modules=['objgraph'],
**setuptools_options)
......@@ -53,12 +53,30 @@ def find_doctests():
return glob.glob('docs/*.txt')
def doctest_setup_py_works():
"""Test that setup.py works
>>> import sys
>>> orig_argv = sys.argv
>>> sys.argv = ['setup.py', '--description']
>>> import setup
Draws Python object reference graphs with graphviz
>>> sys.argv = orig_argv
"""
def test_suite():
doctests = find_doctests()
return doctest.DocFileSuite(setUp=setUp, tearDown=tearDown,
optionflags=doctest.ELLIPSIS,
checker=IgnoreNodeCountChecker(),
*doctests)
return unittest.TestSuite([
doctest.DocFileSuite(setUp=setUp, tearDown=tearDown,
optionflags=doctest.ELLIPSIS,
checker=IgnoreNodeCountChecker(),
*doctests),
doctest.DocTestSuite(),
])
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment