app-misc/ola: support installing Python bindings

Signed-off-by: Marek Szuba <marecki@gentoo.org>
This commit is contained in:
Marek Szuba
2022-10-04 13:50:20 +01:00
parent 45f639f2fd
commit 3a7fbdfb07
3 changed files with 71 additions and 2 deletions
@@ -0,0 +1,31 @@
--- a/python/ola/OlaClient.py
+++ b/python/ola/OlaClient.py
@@ -952,7 +952,7 @@
controller = SimpleRpcController()
request = Ola_pb2.DmxData()
request.universe = universe
- if sys.version >= '3.2':
+ if sys.version_info[:3] >= (3,2):
request.data = data.tobytes()
else:
request.data = data.tostring()
--- a/python/ola/PidStore.py
+++ b/python/ola/PidStore.py
@@ -645,7 +645,7 @@
(self.name, self.min))
try:
- if sys.version >= '3.2':
+ if sys.version_info[:3] >= (3,2):
data = struct.unpack('%ds' % arg_size, bytes(arg, 'utf8'))
else:
data = struct.unpack('%ds' % arg_size, arg)
@@ -668,7 +668,7 @@
except struct.error as e:
raise UnpackException(e)
- if sys.version >= '3.2':
+ if sys.version_info[:3] >= (3,2):
return value[0].rstrip(b'\x00').decode('utf-8')
else:
return value[0].rstrip(b'\x00')
+1
View File
@@ -19,5 +19,6 @@
<use>
<flag name="ftdi">Support FTDI devices</flag>
<flag name="http">Enable built-in Web UI</flag>
<flag name="rdm-tests">Install RDM responder tests</flag>
</use>
</pkgmetadata>
+39 -2
View File
@@ -3,7 +3,9 @@
EAPI=8
inherit autotools
PYTHON_COMPAT=( python3_{8..10} )
inherit autotools python-single-r1
DESCRIPTION="Open Lighting Architecture, a framework for lighting control information"
HOMEPAGE="https://www.openlighting.org/ola/"
@@ -12,7 +14,10 @@ SRC_URI="https://github.com/OpenLightingProject/${PN}/releases/download/${PV}/${
LICENSE="GPL-2+ LGPL-2.1+"
SLOT="0"
KEYWORDS="~amd64"
IUSE="examples ftdi http osc tcmalloc test usb zeroconf"
IUSE="examples ftdi http osc python rdm-tests tcmalloc test usb zeroconf"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )
rdm-tests? ( python )"
RESTRICT="!test? ( test )"
@@ -22,6 +27,17 @@ RDEPEND="dev-libs/protobuf:=
ftdi? ( dev-embedded/libftdi:1 )
http? ( net-libs/libmicrohttpd:= )
osc? ( media-libs/liblo )
python? (
${PYTHON_DEPS}
$(python_gen_cond_dep '
dev-python/protobuf-python[${PYTHON_USEDEP}]
')
)
rdm-tests? (
$(python_gen_cond_dep '
dev-python/numpy[${PYTHON_USEDEP}]
')
)
tcmalloc? ( dev-util/google-perftools:= )
usb? ( virtual/libusb:1 )
zeroconf? ( net-dns/avahi )"
@@ -32,8 +48,19 @@ BDEPEND="sys-devel/bison
virtual/pkgconfig
test? (
dev-util/cppunit
python? (
${PYTHON_DEPS}
$(python_gen_cond_dep '
dev-python/numpy[${PYTHON_USEDEP}]
dev-python/protobuf-python[${PYTHON_USEDEP}]
')
)
)"
PATCHES=(
"${FILESDIR}"/${PN}-0.10.8-python_version_check.patch
)
src_prepare() {
default
# Upstream recommends doing this even for tarball builds
@@ -48,6 +75,8 @@ src_configure() {
$(use_enable ftdi libftdi)
$(use_enable http)
$(use_enable osc)
$(use_enable python python-libs)
$(use_enable rdm-tests)
$(use_enable tcmalloc)
$(use_enable test unittests)
$(use_enable usb libusb)
@@ -57,5 +86,13 @@ src_configure() {
src_install() {
default
find "${ED}" -name '*.la' -delete || die
if use examples && use python; then
docinto examples
python_fix_shebang python/examples/*.py
dodoc python/examples/*.py
docompress -x /usr/share/doc/${PF}/examples
fi
}