This is an automated email from the ASF dual-hosted git repository. karthikz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-heron.git
The following commit(s) were added to refs/heads/master by this push: new fb18dca Universal heronpy (#2948) fb18dca is described below commit fb18dca55445cc3ad81b77e9142363d99ffb0012 Author: Oliver Bristow <evilumbrella+git...@gmail.com> AuthorDate: Tue Jul 3 17:29:05 2018 +0100 Universal heronpy (#2948) * Use six to make heronpy tests pass * Build universal heronpy wheel * make `bazel.whl` in the //scripts/packages:generate-heronpy-package --- heronpy/api/tests/python/serializer_unittest.py | 3 ++- heronpy/api/topology.py | 5 +++-- scripts/packages/BUILD | 6 ++++-- scripts/packages/heronpy/requirements.txt | 1 + scripts/packages/heronpy/setup.py.template | 3 +++ 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/heronpy/api/tests/python/serializer_unittest.py b/heronpy/api/tests/python/serializer_unittest.py index 0f0c417..65db24a 100644 --- a/heronpy/api/tests/python/serializer_unittest.py +++ b/heronpy/api/tests/python/serializer_unittest.py @@ -23,6 +23,7 @@ import unittest +import six from heronpy.api.serializer import PythonSerializer prim_list = [1000, -234, 0.00023, "string", @@ -39,6 +40,6 @@ class SerializerTest(unittest.TestCase): # Test with a list of primitive types for obj in prim_list: serialized = serializer.serialize(obj) - self.assertIsInstance(serialized, str) + self.assertIsInstance(serialized, six.binary_type) deserialized = serializer.deserialize(serialized) self.assertEqual(deserialized, obj) diff --git a/heronpy/api/topology.py b/heronpy/api/topology.py index a4c8f94..ae7396f 100644 --- a/heronpy/api/topology.py +++ b/heronpy/api/topology.py @@ -26,10 +26,11 @@ import os import uuid import heronpy.api.api_constants as api_constants +import six +from heronpy.api.component.component_spec import HeronComponentSpec from heronpy.api.serializer import default_serializer from heronpy.proto import topology_pb2 -from heronpy.api.component.component_spec import HeronComponentSpec class TopologyType(type): """Metaclass to define a Heron topology in Python""" @@ -256,6 +257,7 @@ class TopologyType(type): return sanitized +@six.add_metaclass(TopologyType) class Topology(object): """Topology is an abstract class for defining a topology @@ -286,7 +288,6 @@ class Topology(object): inputs={word_spout: Grouping.fields('word')}, config={"count_bolt.specific.config": "another value"}) """ - __metaclass__ = TopologyType # pylint: disable=no-member @classmethod diff --git a/scripts/packages/BUILD b/scripts/packages/BUILD index 01bdc2f..7557c33 100644 --- a/scripts/packages/BUILD +++ b/scripts/packages/BUILD @@ -486,9 +486,11 @@ genrule( 'rm setup.py.template', 'tree $$HERONPY_DIR', '/usr/bin/env python2.7 setup.py sdist', - '/usr/bin/env python2.7 setup.py bdist_wheel', + '/usr/bin/env python2.7 setup.py bdist_wheel --universal', + 'cd -', 'ls -l $$HERONPY_DIR/dist', - 'cp $$HERONPY_DIR/dist/heronpy-*-py2-*.whl $$OUTPUT_DIR', + 'cp $$HERONPY_DIR/dist/heronpy-*-py2.py3-*.whl $$OUTPUT_DIR', + 'cp $$HERONPY_DIR/dist/heronpy-*-py2.py3-*.whl "$@"', 'cp $$HERONPY_DIR/dist/heronpy-*.tar.gz $$OUTPUT_DIR', 'touch $$OUTPUT_DIR/heronpy.whl', 'rm -rf $$TMP_DIR', diff --git a/scripts/packages/heronpy/requirements.txt b/scripts/packages/heronpy/requirements.txt index 40e388c..6e23522 100644 --- a/scripts/packages/heronpy/requirements.txt +++ b/scripts/packages/heronpy/requirements.txt @@ -1 +1,2 @@ protobuf==3.4.0 +six diff --git a/scripts/packages/heronpy/setup.py.template b/scripts/packages/heronpy/setup.py.template index f0de259..45e0dad 100644 --- a/scripts/packages/heronpy/setup.py.template +++ b/scripts/packages/heronpy/setup.py.template @@ -35,6 +35,9 @@ setup( 'Intended Audience :: Developers', 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', ], keywords='heron topology python',