Browse Source

A couple of fixes toward Python 3 compatibility

pull/8/head
Jason R. Coombs 14 years ago
parent
commit
0cc9d106d0
  1. 8
      setup.py
  2. 2
      svg/charts/graph.py
  3. 3
      svg/charts/plot.py

8
setup.py

@ -13,12 +13,17 @@ class DisabledTestCommand(Command):
def __init__(self, dist):
raise RuntimeError("test command not supported on svg.charts. Use setup.py nosetests instead")
try:
from distutils.command.build_py import build_py_2to3 as build_py
except ImportError:
from distutils.command.build_py import build_py
_this_dir = os.path.dirname(__file__)
_long_description = open('readme.txt').read().strip()
# it seems that dateutil 2.0 only works under Python 3
dateutil_req = (
['python-dateutil>=1.4,<2.0dev'] if sys.version < (3,0)
['python-dateutil>=1.4,<2.0dev'] if sys.version_info < (3,0)
else ['python-dateutil>=2.0'] )
setup_params = dict(
@ -51,6 +56,7 @@ setup_params = dict(
# see http://code.google.com/p/python-nose/issues/detail?id=219
cmdclass=dict(
test=DisabledTestCommand,
build_py=build_py,
),
)

2
svg/charts/graph.py

@ -91,7 +91,7 @@ class Graph(object):
def __init__(self, config = {}):
"""Initialize the graph object with the graph settings."""
if self.__class__ is Graph:
raise NotImplementedError, "Graph is an abstract base class"
raise NotImplementedError("Graph is an abstract base class")
self.load_config(config)
self.clear_data()
self.style = {}

3
svg/charts/plot.py

@ -262,8 +262,9 @@ class Plot(Graph):
if hasattr(self, 'constant_lines'):
map(self.__draw_constant_line, self.constant_lines)
def __draw_constant_line(self, (value, label, style)):
def __draw_constant_line(self, value_label_style):
"Draw a constant line on the y-axis with the label"
value, label, style = value_label_style
start = self.transform_output_coordinates((0, value))[1]
stop = self.graph_width
path = etree.SubElement(self.graph, 'path', {

Loading…
Cancel
Save