Gentoo Archives: gentoo-commits

From: Arthur Zamarin <arthurzam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pyqtgraph/, dev-python/pyqtgraph/files/
Date: Sun, 10 Oct 2021 04:57:01
Message-Id: 1633841801.50adb7ff6f2b959ae8284133adcdb60ff53d15ec.arthurzam@gentoo
1 commit: 50adb7ff6f2b959ae8284133adcdb60ff53d15ec
2 Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
3 AuthorDate: Sun Oct 10 04:15:54 2021 +0000
4 Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 10 04:56:41 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=50adb7ff
7
8 dev-python/pyqtgraph: enable py3.10, cleanup
9
10 - do the prepare for testing inside src_test
11 - testing depends on opengl and svg use flags
12 - use EPYTEST_DESELECT
13 - add missing "|| die" for git calls
14
15 Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
16
17 .../files/pyqtgraph-0.12.2-fix-py3.10.patch | 46 ++++++++++++++++++++
18 dev-python/pyqtgraph/pyqtgraph-0.12.2.ebuild | 49 ++++++++++++----------
19 2 files changed, 73 insertions(+), 22 deletions(-)
20
21 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
22 new file mode 100644
23 index 00000000000..bb1e4a8a766
24 --- /dev/null
25 +++ b/dev-python/pyqtgraph/files/pyqtgraph-0.12.2-fix-py3.10.patch
26 @@ -0,0 +1,46 @@
27 +From db8180d88ed37425467d030bebf7792c86691b83 Mon Sep 17 00:00:00 2001
28 +From: Scott Talbert <swt@××××××.net>
29 +Date: Sun, 11 Jul 2021 22:04:00 -0400
30 +Subject: [PATCH] Fix GLTextItem with Python 3.10
31 +
32 +drawText() expects int arguments and Python 3.10 does not allow for
33 +implicit rounding.
34 +
35 +--- a/pyqtgraph/opengl/items/GLTextItem.py
36 ++++ b/pyqtgraph/opengl/items/GLTextItem.py
37 +@@ -68,15 +68,15 @@ def paint(self):
38 + viewport = glGetIntegerv(GL_VIEWPORT)
39 +
40 + text_pos = self.__project(self.pos, modelview, projection, viewport)
41 +- text_pos[1] = viewport[3] - text_pos[1]
42 +
43 ++ text_pos.setY(viewport[3] - text_pos.y())
44 + text_pos /= self.view().devicePixelRatio()
45 +
46 + painter = QtGui.QPainter(self.view())
47 + painter.setPen(self.color)
48 + painter.setFont(self.font)
49 + painter.setRenderHints(QtGui.QPainter.RenderHint.Antialiasing | QtGui.QPainter.RenderHint.TextAntialiasing)
50 +- painter.drawText(text_pos[0], text_pos[1], self.text)
51 ++ painter.drawText(text_pos, self.text)
52 + painter.end()
53 +
54 + def __project(self, obj_pos, modelview, projection, viewport):
55 +@@ -86,12 +86,11 @@ def __project(self, obj_pos, modelview, projection, viewport):
56 + proj_vec = np.matmul(projection.T, view_vec)
57 +
58 + if proj_vec[3] == 0.0:
59 +- return
60 ++ return QtCore.QPointF(0, 0)
61 +
62 + proj_vec[0:3] /= proj_vec[3]
63 +
64 +- return np.array([
65 +- viewport[0] + (1.0 + proj_vec[0]) * viewport[2] / 2.0,
66 +- viewport[1] + (1.0 + proj_vec[1]) * viewport[3] / 2.0,
67 +- (1.0 + proj_vec[2]) / 2.0
68 +- ])
69 ++ return QtCore.QPointF(
70 ++ viewport[0] + (1.0 + proj_vec[0]) * viewport[2] / 2,
71 ++ viewport[1] + (1.0 + proj_vec[1]) * viewport[3] / 2
72 ++ )
73
74 diff --git a/dev-python/pyqtgraph/pyqtgraph-0.12.2.ebuild b/dev-python/pyqtgraph/pyqtgraph-0.12.2.ebuild
75 index 3bc55a927f1..c6366f824b7 100644
76 --- a/dev-python/pyqtgraph/pyqtgraph-0.12.2.ebuild
77 +++ b/dev-python/pyqtgraph/pyqtgraph-0.12.2.ebuild
78 @@ -3,7 +3,7 @@
79
80 EAPI=8
81
82 -PYTHON_COMPAT=( python3_{8..9} )
83 +PYTHON_COMPAT=( python3_{8..10} )
84 inherit distutils-r1 multiprocessing
85
86 TEST_DATA_TAG=test-data-8
87 @@ -21,6 +21,7 @@ LICENSE="MIT"
88 SLOT="0"
89 KEYWORDS="amd64 x86"
90 IUSE="examples opengl svg"
91 +REQUIRED_USE="test? ( opengl svg )"
92
93 RDEPEND="
94 >=dev-python/numpy-1.17[${PYTHON_USEDEP}]
95 @@ -30,57 +31,61 @@ RDEPEND="
96 BDEPEND="
97 test? (
98 dev-python/h5py[${PYTHON_USEDEP}]
99 - dev-python/PyQt5[svg,testlib,${PYTHON_USEDEP}]
100 + dev-python/PyQt5[testlib,${PYTHON_USEDEP}]
101 dev-python/pytest-xdist[${PYTHON_USEDEP}]
102 dev-python/pytest-xvfb[${PYTHON_USEDEP}]
103 dev-vcs/git
104 )"
105
106 +PATCHES=(
107 + "${FILESDIR}/${P}-fix-py3.10.patch"
108 +)
109 +
110 distutils_enable_sphinx doc/source
111 distutils_enable_tests pytest
112
113 python_prepare_all() {
114 distutils-r1_python_prepare_all
115
116 - if use test; then
117 - mkdir "${HOME}"/.pyqtgraph || die
118 - mv "${WORKDIR}/test-data-${TEST_DATA_TAG}" \
119 - "${HOME}"/.pyqtgraph/test-data || die
120 - cd "${HOME}"/.pyqtgraph/test-data || die
121 - # we need to fake a git repo
122 - git config --global user.email "you@×××××××.com"
123 - git config --global user.name "Your Name"
124 - git init -q || die
125 - git commit -q --allow-empty -m "dummy commit" || die
126 - git tag "${TEST_DATA_TAG}" || die
127 - cd - >/dev/null || die
128 - fi
129 if ! use opengl; then
130 rm -r pyqtgraph/opengl || die
131 fi
132 }
133
134 python_test() {
135 - local deselect=(
136 + local EPYTEST_DESELECT=(
137 # apparently fragile
138 - --deselect tests/test_reload.py::test_reload
139 + tests/test_reload.py::test_reload
140
141 # TODO
142 - --deselect tests/graphicsItems/test_ROI.py::test_PolyLineROI
143 + tests/graphicsItems/test_ROI.py::test_PolyLineROI
144
145 # pyside2 is normally skipped if not installed but these two
146 # fail if it is installed
147 # TODO: this could be due to USE flags, revisit when pyside2
148 # gains py3.9
149 - --deselect
150 'examples/test_examples.py::testExamples[ DateAxisItem_QtDesigner.py - PySide2 ]'
151 - --deselect
152 'examples/test_examples.py::testExamples[ designerExample.py - PySide2 ]'
153 )
154
155 distutils_install_for_testing
156 - epytest "${deselect[@]}" \
157 - -n "$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")"
158 + epytest -n "$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")"
159 +}
160 +
161 +src_test() {
162 + mkdir "${HOME}"/.pyqtgraph || die
163 + mv "${WORKDIR}/test-data-${TEST_DATA_TAG}" \
164 + "${HOME}"/.pyqtgraph/test-data || die
165 + cd "${HOME}"/.pyqtgraph/test-data || die
166 + # we need to fake a git repo
167 + git config --global user.email "you@×××××××.com" || die
168 + git config --global user.name "Your Name" || die
169 + git init -q || die
170 + git commit -q --allow-empty -m "dummy commit" || die
171 + git tag "${TEST_DATA_TAG}" || die
172 + cd - >/dev/null || die
173 +
174 + distutils-r1_src_test
175 }
176
177 python_install_all() {