summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2021-10-10 07:15:54 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2021-10-10 07:56:41 +0300
commit50adb7ff6f2b959ae8284133adcdb60ff53d15ec (patch)
tree66bfdc13d8e7d2aa81219d5f871db8ca1bdde16e /dev-python/pyqtgraph
parentkde-apps/ktp-send-file: keyword 21.08.2 for ~riscv (diff)
downloadgentoo-50adb7ff6f2b959ae8284133adcdb60ff53d15ec.tar.gz
gentoo-50adb7ff6f2b959ae8284133adcdb60ff53d15ec.tar.bz2
gentoo-50adb7ff6f2b959ae8284133adcdb60ff53d15ec.zip
dev-python/pyqtgraph: enable py3.10, cleanup
- do the prepare for testing inside src_test - testing depends on opengl and svg use flags - use EPYTEST_DESELECT - add missing "|| die" for git calls Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'dev-python/pyqtgraph')
-rw-r--r--dev-python/pyqtgraph/files/pyqtgraph-0.12.2-fix-py3.10.patch46
-rw-r--r--dev-python/pyqtgraph/pyqtgraph-0.12.2.ebuild49
2 files changed, 73 insertions, 22 deletions
diff --git a/dev-python/pyqtgraph/files/pyqtgraph-0.12.2-fix-py3.10.patch b/dev-python/pyqtgraph/files/pyqtgraph-0.12.2-fix-py3.10.patch
new file mode 100644
index 000000000000..bb1e4a8a766a
--- /dev/null
+++ b/dev-python/pyqtgraph/files/pyqtgraph-0.12.2-fix-py3.10.patch
@@ -0,0 +1,46 @@
+From db8180d88ed37425467d030bebf7792c86691b83 Mon Sep 17 00:00:00 2001
+From: Scott Talbert <swt@techie.net>
+Date: Sun, 11 Jul 2021 22:04:00 -0400
+Subject: [PATCH] Fix GLTextItem with Python 3.10
+
+drawText() expects int arguments and Python 3.10 does not allow for
+implicit rounding.
+
+--- a/pyqtgraph/opengl/items/GLTextItem.py
++++ b/pyqtgraph/opengl/items/GLTextItem.py
+@@ -68,15 +68,15 @@ def paint(self):
+ viewport = glGetIntegerv(GL_VIEWPORT)
+
+ text_pos = self.__project(self.pos, modelview, projection, viewport)
+- text_pos[1] = viewport[3] - text_pos[1]
+
++ text_pos.setY(viewport[3] - text_pos.y())
+ text_pos /= self.view().devicePixelRatio()
+
+ painter = QtGui.QPainter(self.view())
+ painter.setPen(self.color)
+ painter.setFont(self.font)
+ painter.setRenderHints(QtGui.QPainter.RenderHint.Antialiasing | QtGui.QPainter.RenderHint.TextAntialiasing)
+- painter.drawText(text_pos[0], text_pos[1], self.text)
++ painter.drawText(text_pos, self.text)
+ painter.end()
+
+ def __project(self, obj_pos, modelview, projection, viewport):
+@@ -86,12 +86,11 @@ def __project(self, obj_pos, modelview, projection, viewport):
+ proj_vec = np.matmul(projection.T, view_vec)
+
+ if proj_vec[3] == 0.0:
+- return
++ return QtCore.QPointF(0, 0)
+
+ proj_vec[0:3] /= proj_vec[3]
+
+- return np.array([
+- viewport[0] + (1.0 + proj_vec[0]) * viewport[2] / 2.0,
+- viewport[1] + (1.0 + proj_vec[1]) * viewport[3] / 2.0,
+- (1.0 + proj_vec[2]) / 2.0
+- ])
++ return QtCore.QPointF(
++ viewport[0] + (1.0 + proj_vec[0]) * viewport[2] / 2,
++ viewport[1] + (1.0 + proj_vec[1]) * viewport[3] / 2
++ )
diff --git a/dev-python/pyqtgraph/pyqtgraph-0.12.2.ebuild b/dev-python/pyqtgraph/pyqtgraph-0.12.2.ebuild
index 3bc55a927f18..c6366f824b79 100644
--- a/dev-python/pyqtgraph/pyqtgraph-0.12.2.ebuild
+++ b/dev-python/pyqtgraph/pyqtgraph-0.12.2.ebuild
@@ -3,7 +3,7 @@
EAPI=8
-PYTHON_COMPAT=( python3_{8..9} )
+PYTHON_COMPAT=( python3_{8..10} )
inherit distutils-r1 multiprocessing
TEST_DATA_TAG=test-data-8
@@ -21,6 +21,7 @@ LICENSE="MIT"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE="examples opengl svg"
+REQUIRED_USE="test? ( opengl svg )"
RDEPEND="
>=dev-python/numpy-1.17[${PYTHON_USEDEP}]
@@ -30,57 +31,61 @@ RDEPEND="
BDEPEND="
test? (
dev-python/h5py[${PYTHON_USEDEP}]
- dev-python/PyQt5[svg,testlib,${PYTHON_USEDEP}]
+ dev-python/PyQt5[testlib,${PYTHON_USEDEP}]
dev-python/pytest-xdist[${PYTHON_USEDEP}]
dev-python/pytest-xvfb[${PYTHON_USEDEP}]
dev-vcs/git
)"
+PATCHES=(
+ "${FILESDIR}/${P}-fix-py3.10.patch"
+)
+
distutils_enable_sphinx doc/source
distutils_enable_tests pytest
python_prepare_all() {
distutils-r1_python_prepare_all
- if use test; then
- mkdir "${HOME}"/.pyqtgraph || die
- mv "${WORKDIR}/test-data-${TEST_DATA_TAG}" \
- "${HOME}"/.pyqtgraph/test-data || die
- cd "${HOME}"/.pyqtgraph/test-data || die
- # we need to fake a git repo
- git config --global user.email "you@example.com"
- git config --global user.name "Your Name"
- git init -q || die
- git commit -q --allow-empty -m "dummy commit" || die
- git tag "${TEST_DATA_TAG}" || die
- cd - >/dev/null || die
- fi
if ! use opengl; then
rm -r pyqtgraph/opengl || die
fi
}
python_test() {
- local deselect=(
+ local EPYTEST_DESELECT=(
# apparently fragile
- --deselect tests/test_reload.py::test_reload
+ tests/test_reload.py::test_reload
# TODO
- --deselect tests/graphicsItems/test_ROI.py::test_PolyLineROI
+ tests/graphicsItems/test_ROI.py::test_PolyLineROI
# pyside2 is normally skipped if not installed but these two
# fail if it is installed
# TODO: this could be due to USE flags, revisit when pyside2
# gains py3.9
- --deselect
'examples/test_examples.py::testExamples[ DateAxisItem_QtDesigner.py - PySide2 ]'
- --deselect
'examples/test_examples.py::testExamples[ designerExample.py - PySide2 ]'
)
distutils_install_for_testing
- epytest "${deselect[@]}" \
- -n "$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")"
+ epytest -n "$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")"
+}
+
+src_test() {
+ mkdir "${HOME}"/.pyqtgraph || die
+ mv "${WORKDIR}/test-data-${TEST_DATA_TAG}" \
+ "${HOME}"/.pyqtgraph/test-data || die
+ cd "${HOME}"/.pyqtgraph/test-data || die
+ # we need to fake a git repo
+ git config --global user.email "you@example.com" || die
+ git config --global user.name "Your Name" || die
+ git init -q || die
+ git commit -q --allow-empty -m "dummy commit" || die
+ git tag "${TEST_DATA_TAG}" || die
+ cd - >/dev/null || die
+
+ distutils-r1_src_test
}
python_install_all() {