Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@ elif [[ $TASK = 'jshint' ]]; then
grunt test
else
# Otherwise compile and check as normal
virtualenv python-env && source python-env/bin/activate
autoreconf -i && ./configure --enable-rdm-tests --enable-ja-rule && make distcheck DISTCHECK_CONFIGURE_FLAGS='--enable-rdm-tests --enable-ja-rule'
fi
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ before_install:
- if [ "$TASK" = "doxygen" ]; then sudo apt-get install -qq doxygen graphviz; fi
#Install grunt if required
- if [ "$TASK" = "jshint"]; then sudo npm install -g grunt-cli; fi
- sudo pip install virtualenv

after_success:
- if [ "$TASK" = "coverity" ]; then cat /home/travis/build/${TRAVIS_REPO_SLUG}/cov-int/scm_log.txt; fi
Expand Down
33 changes: 19 additions & 14 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -614,15 +614,7 @@ AC_ARG_ENABLE(
#####################################################
AM_CONDITIONAL([BUILD_PYTHON_LIBS], [test "x$enable_python_libs" = xyes])

AS_IF([test "${enable_python_libs}" = "yes"],
[AM_PATH_PYTHON(2.6)
AS_IF([test -z $PYTHON], [PYTHON="python"])
PYTHON_NAME=`basename $PYTHON`
AC_CACHE_CHECK([for $PYTHON_NAME module: google.protobuf],
[ac_cv_have_pymod_google_protobuf],
[AX_PYTHON_MODULE([google.protobuf], [fatal])
eval ac_cv_have_pymod_google_protobuf=\$AS_TR_CPP([HAVE_PYMOD_google.protobuf])])
])
AS_IF([test "${enable_python_libs}" = "yes"], [AM_PATH_PYTHON(2.6)])

# Libraries, that depend on the feature args above.
#####################################################
Expand Down Expand Up @@ -733,14 +725,26 @@ fi
# Python modules can't be split over two directories. This is a problem when
# doing VPATH builds since the generated files like
# ${builddir}/python/ola/Ola_pb.py will be in a separate path ( $builddir ) from
# the non-generated files $srcdir/python/ols/PidStore.py). To get the tests
# to pass we symlink the files we need for the tests from the builddir to the
# srcdir and set PYTHONPATH=${top_builddir}/python in data/rdm/Makefile.am
AC_CONFIG_LINKS([python/ola/PidStore.py:python/ola/PidStore.py
# the non-generated files $srcdir/python/ola/PidStore.py). To build a complete
# module, we symlink the files from the builddir to the srcdir and set
# PYTHONPATH=${top_builddir}/python in data/rdm/Makefile.am
AC_CONFIG_LINKS([python/ola/ClientWrapper.py:python/ola/ClientWrapper.py
python/ola/DMXConstants.py:python/ola/DMXConstants.py
python/ola/DUBDecoder.py:python/ola/DUBDecoder.py
python/ola/DUBDecoderTest.py:python/ola/DUBDecoderTest.py
python/ola/__init__.py:python/ola/__init__.py
python/ola/MACAddress.py:python/ola/MACAddress.py
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SPaG ola

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

python/ola/MACAddressTest.py:python/ola/MACAddressTest.py
python/ola/OlaClient.py:python/ola/OlaClient.py
python/ola/PidStore.py:python/ola/PidStore.py
python/ola/RDMAPI.py:python/ola/RDMAPI.py
python/ola/RDMConstants.py:python/ola/RDMConstants.py
python/ola/rpc/__init__.py:python/ola/rpc/__init__.py
python/ola/rpc/SimpleRpcController.py:python/ola/rpc/SimpleRpcController.py
python/ola/rpc/SimpleRpcControllerTest.py:python/ola/rpc/SimpleRpcControllerTest.py
python/ola/rpc/StreamRpcChannel.py:python/ola/rpc/StreamRpcChannel.py
python/ola/UID.py:python/ola/UID.py
python/ola/__init__.py:python/ola/__init__.py])
python/ola/UIDTest.py:python/ola/UIDTest.py])

# Non-makefile generated files.
AC_CONFIG_FILES([include/ola/base/Version.h
Expand All @@ -750,6 +754,7 @@ AC_CONFIG_FILES([include/ola/base/Version.h
plugins/e131/e131/libolaacn.pc
plugins/e131/messages/libolae131conf.pc
plugins/usbpro/messages/libolausbproconf.pc
python/setup.py
tools/e133/libolae133common.pc
tools/e133/libolae133controller.pc
])
Expand Down
3 changes: 3 additions & 0 deletions python/Makefile.mk
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
include python/examples/Makefile.mk
include python/ola/Makefile.mk

install-exec-local:
pushd python && python setup.py install && popd
16 changes: 1 addition & 15 deletions python/ola/Makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,13 @@ usbpro_path = ${top_srcdir}/plugins/usbpro/messages
usbpro_proto = $(usbpro_path)/UsbProConfigMessages.proto

if BUILD_PYTHON_LIBS
output_files = \
built_sources += \
python/ola/ArtNetConfigMessages_pb2.py \
python/ola/Ola_pb2.py \
python/ola/UsbProConfigMessages_pb2.py \
python/ola/Pids_pb2.py \
python/ola/PidStoreLocation.py \
python/ola/Version.py
built_sources += $(output_files)

nodist_pkgpython_PYTHON = $(output_files)
pkgpython_PYTHON = \
python/ola/ClientWrapper.py \
python/ola/DMXConstants.py \
python/ola/DUBDecoder.py \
python/ola/MACAddress.py \
python/ola/OlaClient.py \
python/ola/RDMAPI.py \
python/ola/RDMConstants.py \
python/ola/PidStore.py \
python/ola/UID.py \
python/ola/__init__.py
endif

python/ola/ArtNetConfigMessages_pb2.py: $(artnet_proto)
Expand Down
14 changes: 14 additions & 0 deletions python/ola/UID.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@ def __cmp__(self, other):
return cmp(self._device_id, other._device_id)
return cmp(self.manufacturer_id, other.manufacturer_id)

def __lt__(self, other):
# Still needed for Python 2
if other is None:
return False

if self.manufacturer_id != other.manufacturer_id:
return self.manufacturer_id < other.manufacturer_id
else:
return self.device_id < other.device_id

def __eq__(self, other):
return self.manufacturer_id == other.manufacturer_id and \
self.device_id == other.device_id

@staticmethod
def AllDevices():
return UID(0xffff, 0xffffffff)
Expand Down
5 changes: 0 additions & 5 deletions python/ola/rpc/Makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
# Python modules.
##################################################
if BUILD_PYTHON_LIBS
rpcpythondir = $(pkgpythondir)/rpc
nodist_rpcpython_PYTHON = python/ola/rpc/Rpc_pb2.py
rpcpython_PYTHON = python/ola/rpc/SimpleRpcController.py \
python/ola/rpc/StreamRpcChannel.py \
python/ola/rpc/__init__.py
built_sources += python/ola/rpc/Rpc_pb2.py
endif

Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 5 additions & 1 deletion python/ola/UIDTest.py → python/ola/tests/UID_test.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

__author__ = 'nomis52@gmail.com (Simon Newton)'

import sys
import unittest
from ola.UID import UID, UIDOutOfRangeException

Expand All @@ -32,7 +33,10 @@ def testBasic(self):
self.assertEqual(0x12345678, uid.device_id)
self.assertEqual('707a:12345678', str(uid))

self.assertTrue(uid > None)
# Python 3 does not allow sorting of incompatible types.
if sys.version_info.major == 2:
self.assertTrue(uid > None)

uid2 = UID(0x707a, 0x12345679)
self.assertTrue(uid2 > uid)
uid3 = UID(0x7079, 0x12345678)
Expand Down
17 changes: 17 additions & 0 deletions python/setup.py.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env python

from setuptools import setup


setup(
name='ola',
version='@VERSION@',
author='Simon Newton',
author_email='nomis52@gmail.com',
description='OLA Python client bindings.',
license='GPL',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The note for this says the license should only be used when "the license is not a selection from the “License” Trove classifiers. See the Classifier field. Notice that there’s a licence distribution option which is deprecated but still acts as an alias for license.":
https://docs.python.org/2/distutils/setupscript.html#additional-meta-data

Either way, the client should be LGPL 2.1 or greater (rather than GPL):
https://github.com/OpenLightingProject/ola/blob/master/python/ola/OlaClient.py#L2-L4

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url='https://www.openlighting.org',
packages=['ola', 'ola.rpc'],
zip_safe=False,
install_requires=['protobuf>=2.6.1'],
)