Commit 7c28cafe authored by SVN-Git Migration's avatar SVN-Git Migration

Imported Upstream version 1.4.0

parent beaf306d
include Makefile
include examples.txt
include *.png
include tests.py
PYTHON = python
FILE_WITH_VERSION = objgraph.py
FILE_WITH_CHANGELOG = objgraph.py
.PHONY: default
default:
@echo "Nothing to build here"
.PHONY: test check
test check:
$(PYTHON) tests.py
.PHONY: dist
dist:
$(PYTHON) setup.py sdist
.PHONY: distcheck
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; }
make dist
pkg_and_version=`$(PYTHON) setup.py --name`-`$(PYTHON) setup.py --version` && \
rm -rf tmp && \
mkdir tmp && \
bzr export tmp/tree && \
cd tmp && \
tar xvzf ../dist/$$pkg_and_version.tar.gz && \
diff -ur $$pkg_and_version tree -x PKG-INFO -x setup.cfg -x '*.egg-info' && \
cd $$pkg_and_version && \
make dist check && \
cd .. && \
mkdir one two && \
cd one && \
tar xvzf ../../dist/$$pkg_and_version.tar.gz && \
cd ../two/ && \
tar xvzf ../$$pkg_and_version/dist/$$pkg_and_version.tar.gz && \
cd .. && \
diff -ur one two -x SOURCES.txt && \
cd .. && \
rm -rf tmp && \
echo "sdist seems to be ok"
.PHONY: releasechecklist
releasechecklist:
@$(PYTHON) setup.py --version | grep -qv dev || { \
echo "Please remove the 'dev' suffix from the version number in $(FILE_WITH_VERSION)"; exit 1; }
@$(PYTHON) setup.py --long-description | rst2html --exit-status=2 > /dev/null
@ver_and_date="`$(PYTHON) setup.py --version` (`date +%Y-%m-%d`)" && \
grep -q "^$$ver_and_date$$" $(FILE_WITH_CHANGELOG) || { \
echo "$(FILE_WITH_CHANGELOG) has no entry for $$ver_and_date"; exit 1; }
make distcheck
.PHONY: release
release: releasechecklist
# I'm chicken so I won't actually do these things yet
@echo "Please run"
@echo
@echo " $(PYTHON) setup.py sdist register upload && bzr tag `$(PYTHON) setup.py --version`"
@echo
@echo "Please increment the version number in $(FILE_WITH_VERSION)"
@echo "and add a new empty entry at the top of the changelog in $(FILE_WITH_CHANGELOG), then"
@echo
@echo ' bzr ci -m "Post-release version bump" && bzr push'
@echo
Metadata-Version: 1.0
Name: objgraph
Version: 1.2
Version: 1.4.0
Summary: Draws Python object reference graphs with graphviz
Home-page: http://mg.pov.lt/objgraph/
Author: Marius Gedminas
......
......@@ -24,7 +24,9 @@ Try this in a Python shell:
>>> x = []
>>> y = [x, [x], dict(x=x)]
>>> import objgraph
>>> objgraph.show_refs([y])
>>> objgraph.show_refs([y], filename='sample-graph.png')
Graph written to ....dot (5 nodes)
Image generated as sample-graph.png
You should see a graph like this:
......@@ -33,7 +35,9 @@ You should see a graph like this:
Now try
>>> objgraph.show_backrefs([x])
>>> objgraph.show_backrefs([x], filename='sample-backref-graph.png')
Graph written to ....dot (7 nodes)
Image generated as sample-backref-graph.png
and you'll see
......
More examples
-------------
Objects that have a __del__ method
>>> class Nondestructible(list):
... def __del__(self):
... pass
>>> x = Nondestructible()
>>> y = []
>>> z = []
>>> x.append(y)
>>> y.append(z)
>>> z.append(x)
>>> del x, y, z
>>> import objgraph
>>> objgraph.show_backrefs(objgraph.by_type('Nondestructible'),
... filename='finalizers.png')
Graph written to ....dot (3 nodes)
Image generated as finalizers.png
.. image:: finalizers.png
Metadata-Version: 1.0
Name: objgraph
Version: 1.2
Version: 1.4.0
Summary: Draws Python object reference graphs with graphviz
Home-page: http://mg.pov.lt/objgraph/
Author: Marius Gedminas
......
MANIFEST.in
Makefile
README.txt
examples.txt
finalizers.png
objgraph.py
sample-backref-graph.png
sample-graph.png
setup.py
tests.py
objgraph.egg-info/PKG-INFO
objgraph.egg-info/SOURCES.txt
objgraph.egg-info/dependency_links.txt
......
This diff is collapsed.
import os, sys
#!/usr/bin/python
import os, sys, doctest
try:
from setuptools import setup
except ImportError:
from distutils import setup
from distutils.core import setup
def relative(filename):
......@@ -17,35 +18,15 @@ def get_version():
return d['__version__']
def build_script_to_build_images():
yield 'import os'
for line in open(relative('README.txt')):
if line.startswith(' >>>') or line.startswith(' ...'):
yield line[8:].rstrip()
if line.startswith('.. image:: '):
filename = line.split()[2]
yield 'os.system("dot -Tpng objects.dot > %s")' % filename
def build_images(sources=['README.txt', 'examples.txt']):
for fn in sources:
doctest.testfile(fn, optionflags=doctest.ELLIPSIS)
def script_to_build_images():
return '\n'.join(build_script_to_build_images())
def build_images():
os.popen(sys.executable, 'w').write(script_to_build_images())
if len(sys.argv) > 1 and sys.argv[1] == '--show-image-script':
print script_to_build_images()
sys.exit(0)
if len(sys.argv) > 1 and sys.argv[1] == '--build-images':
build_images()
sys.exit(0)
if len(sys.argv) > 1 and sys.argv[1] == '--objgraph-version':
print get_version()
sys.exit(0)
setup(name='objgraph',
version=get_version(),
......
#!/usr/bin/python
import unittest
import doctest
import tempfile
import os
import shutil
def setUp(test):
test.tmpdir = tempfile.mkdtemp(prefix='test-objgraph-')
test.prevdir = os.getcwd()
os.chdir(test.tmpdir)
def tearDown(test):
os.chdir(test.prevdir)
shutil.rmtree(test.tmpdir)
def test_suite():
return doctest.DocFileSuite('README.txt', 'examples.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.ELLIPSIS)
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