diff --git a/setup.py b/setup.py index d11b75c..b7e88c7 100644 --- a/setup.py +++ b/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, ), ) diff --git a/svg/charts/graph.py b/svg/charts/graph.py index ef29b0a..84d96a0 100644 --- a/svg/charts/graph.py +++ b/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 = {} diff --git a/svg/charts/plot.py b/svg/charts/plot.py index 7729c3b..19affc8 100644 --- a/svg/charts/plot.py +++ b/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', {