summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Szuba <marecki@gentoo.org>2022-10-04 12:27:20 +0100
committerMarek Szuba <marecki@gentoo.org>2022-10-04 13:50:20 +0100
commit3a7fbdfb074e7482ca1ded2e5eafbb915f20fd99 (patch)
tree6eb60b87a1743252089e37a302c22c5e11323417 /app-misc
parentdev-python/QtPy: add 2.2.1 (diff)
downloadgentoo-3a7fbdfb074e7482ca1ded2e5eafbb915f20fd99.tar.gz
gentoo-3a7fbdfb074e7482ca1ded2e5eafbb915f20fd99.tar.bz2
gentoo-3a7fbdfb074e7482ca1ded2e5eafbb915f20fd99.zip
app-misc/ola: support installing Python bindings
Signed-off-by: Marek Szuba <marecki@gentoo.org>
Diffstat (limited to 'app-misc')
-rw-r--r--app-misc/ola/files/ola-0.10.8-python_version_check.patch31
-rw-r--r--app-misc/ola/metadata.xml1
-rw-r--r--app-misc/ola/ola-0.10.8.ebuild41
3 files changed, 71 insertions, 2 deletions
diff --git a/app-misc/ola/files/ola-0.10.8-python_version_check.patch b/app-misc/ola/files/ola-0.10.8-python_version_check.patch
new file mode 100644
index 000000000000..a4a82f916fa0
--- /dev/null
+++ b/app-misc/ola/files/ola-0.10.8-python_version_check.patch
@@ -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')
diff --git a/app-misc/ola/metadata.xml b/app-misc/ola/metadata.xml
index fe23c959e3e0..90cb6324410e 100644
--- a/app-misc/ola/metadata.xml
+++ b/app-misc/ola/metadata.xml
@@ -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>
diff --git a/app-misc/ola/ola-0.10.8.ebuild b/app-misc/ola/ola-0.10.8.ebuild
index e9fa6752713f..bcb9094e62e1 100644
--- a/app-misc/ola/ola-0.10.8.ebuild
+++ b/app-misc/ola/ola-0.10.8.ebuild
@@ -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
}