# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 DISTUTILS_USE_PEP517=setuptools PYTHON_COMPAT=( python3_{12..14} ) inherit distutils-r1 DESCRIPTION="A pure-python graphics and GUI library built on PyQt and numpy" HOMEPAGE=" https://www.pyqtgraph.org/ https://github.com/pyqtgraph/pyqtgraph/ https://pypi.org/project/pyqtgraph/ " SRC_URI=" https://github.com/pyqtgraph/pyqtgraph/archive/${P}.tar.gz -> ${P}.gh.tar.gz " S=${WORKDIR}/${PN}-${P} LICENSE="MIT" SLOT="0" KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86" IUSE="opengl svg pyside6 +pyqt6" REQUIRED_USE="test? ( opengl svg ) || ( pyside6 pyqt6 )" RDEPEND=" dev-python/colorama[${PYTHON_USEDEP}] 0 { i-- next } { print } ' pyqtgraph/Qt/__init__.py || die "Failed to patch supported Qt versions" # We also need to remove them from load order. local liborder=() local qt # The order is important (we want to prefer the newest at runtime) for qt in pyqt6 pyside6; do if use ${qt}; then liborder+=( "${qt^^}" ) fi done gawk -v libOrder="$(printf "%s, " "${liborder[@]}")" -i inplace ' BEGIN { libOrder = "[" substr(libOrder, 1, length(libOrder) - 2) "]" } /libOrder = \[PYQT6, PYSIDE6, PYQT5, PYSIDE2\]/ { sub(/\[PYQT6, PYSIDE6, PYQT5, PYSIDE2\]/, libOrder) } { print } ' pyqtgraph/Qt/__init__.py || die "Failed to patch qt version order" # Finally update the list of supported frontends in test to never try unsupported or deselected if use test; then local frontends=() for qt in pyqt6 pyside6; do if use ${qt}; then frontends+=( "Qt.${qt^^}: False," ) fi done gawk -v frontends="$(printf "%s\n" "${frontends[@]}")" -i inplace ' BEGIN { i = 0 split(frontends, frontend_array, "\n") j = 1 } /frontends = {/ { i = 6 # length of frontends print "frontends = {" for (k = 1; k <= length(frontend_array); k++) { print " " frontend_array[k] } print "}" } i > 0 { i-- next } { print } ' pyqtgraph/examples/test_examples.py || die "Failed to patch test frontends" fi }