Skip to content

Commit 94395c4

Browse files
committed
Centralised place for __version__, etc. Made importing in Py3K possible.
1 parent 4a25cef commit 94395c4

File tree

10 files changed

+40
-17
lines changed

10 files changed

+40
-17
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ docs/_build/
22
build/
33
.cache/
44
.coverage
5+
dist/
6+
*.egg-info
57

68
*.pyc
79
*.png

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ before_install:
1616
- sudo apt-get install -qq graphviz
1717

1818
install:
19-
- "echo Python $TRAVIS_PYTHON_VERSION"
2019
- "pip install -r requirements/development.txt --use-mirrors"
2120
- "if [[ $TRAVIS_PYTHON_VERSION == '3.3' ]]; then 2to3 -wn pycallgraph; 2to3 -wn test; fi"
2221

COPYING LICENSE

File renamed without changes.

docs/conf.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# add these directories to sys.path here. If the directory is relative to the
1818
# documentation root, use os.path.abspath to make it absolute, like shown here.
1919
sys.path.insert(0, os.path.abspath('..'))
20+
import pycallgraph
2021

2122
# -- General configuration -----------------------------------------------------
2223

@@ -48,9 +49,9 @@
4849
# built documents.
4950
#
5051
# The short X.Y version.
51-
version = '1.0.0'
52+
version = pycallgraph.__version__
5253
# The full version, including alpha/beta/rc tags.
53-
release = '1.0.0'
54+
release = pycallgraph.__version__
5455

5556
# The language for content autogenerated by Sphinx. Refer to documentation
5657
# for a list of supported languages.

pycallgraph/__init__.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@
44
55
See http://pycallgraph.slowchop.com/ for more information.
66
'''
7+
from .metadata import __version__
8+
from .metadata import __copyright__
9+
from .metadata import __license__
10+
from .metadata import __author__
11+
from .metadata import __email__
12+
from .metadata import __url__
13+
from .metadata import __credits__
714

815
from .pycallgraph import PyCallGraph
9-
1016
from .config import Config
1117
from .globbing_filter import GlobbingFilter
1218

pycallgraph/metadata.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
# A different file to pycallgraph.py because of circular import problem
2+
13
__version__ = '1.0.0'
24
__copyright__ = 'Copyright Gerald Kaszuba 2007-2013'
35
__license__ = 'GPLv2'
46
__author__ = 'Gerald Kaszuba'
57
__email__ = '[email protected]'
8+
__url__ = 'http://pycallgraph.slowchop.com/'
69
__credits__ = [
710
'Gerald Kaszuba',
811
]

pycallgraph/output/pickle.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import cPickle as pickle
1+
try:
2+
import cPickle as pickle
3+
except ImportError:
4+
import pickle
25

36
from .output import Output
47

pycallgraph/output/ubigraph.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import xmlrpclib
1+
try:
2+
from xmlrpclib import Server
3+
except ImportError:
4+
from xmlrpc.client import Server
5+
26

37
from ..exceptions import PyCallGraphException
48
from .output import Output
@@ -10,7 +14,7 @@ def __init__(self):
1014
self.server_url = 'http://127.0.0.1:20738/RPC2'
1115

1216
def start(self):
13-
server = xmlrpclib.Server(self.server_url)
17+
server = Server(self.server_url)
1418
self.graph = server.ubigraph
1519

1620
# Create a graph

pycallgraph/tracer.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
from distutils import sysconfig
99
from collections import defaultdict
1010
from threading import Thread
11-
from Queue import Queue, Empty
11+
try:
12+
from Queue import Queue, Empty
13+
except ImportError:
14+
from queue import Queue, Empty
1215

1316
from .globbing_filter import GlobbingFilter
1417

setup.py

+11-9
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
from os import path
44
from setuptools import setup
55

6-
# TODO: Have the version in only one place
7-
__version__ = '1.0.0'
6+
import pycallgraph as pycg
87

98
# Only install the man page if the correct directory exists
109
# XXX: Commented because easy_install doesn't like it
@@ -18,12 +17,13 @@
1817

1918
setup(
2019
name='pycallgraph',
21-
version=__version__,
22-
description='Python Call Graph uses GraphViz to generate call graphs ' \
23-
'from one execution of your Python code.',
24-
author='Gerald Kaszuba',
25-
author_email='[email protected]',
26-
url='http://pycallgraph.slowchop.com/',
20+
version=pycg.__version__,
21+
description=pycg.__doc__.strip().replace('\n', ' '),
22+
long_description=open('README.md').read(),
23+
author=pycg.__author__,
24+
author_email=pycg.__email__,
25+
license=open('LICENSE').read(),
26+
url=pycg.__url__,
2727
packages=['pycallgraph', 'pycallgraph.output'],
2828
scripts=['scripts/pycallgraph'],
2929
data_files=data_files,
@@ -32,7 +32,7 @@
3232
# TODO: Update download_url
3333
download_url =
3434
'http://pycallgraph.slowchop.com/files/download/pycallgraph-%s.tar.gz' % \
35-
__version__,
35+
pycg.__version__,
3636

3737
classifiers = [
3838
'Development Status :: 4 - Beta',
@@ -41,7 +41,9 @@
4141
'Natural Language :: English',
4242
'Operating System :: OS Independent',
4343
'Programming Language :: Python',
44+
'Programming Language :: Python :: 2.7',
4445
'Programming Language :: Python :: 3',
46+
'Programming Language :: Python :: 3.3',
4547
'Topic :: Software Development :: Libraries :: Python Modules',
4648
'Topic :: Software Development :: Testing',
4749
'Topic :: Software Development :: Debuggers',

0 commit comments

Comments
 (0)