Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/QtPy/
Date: Thu, 30 Jun 2022 16:57:03
Message-Id: 1656608210.34abc17c83bc4e9425e34cbfe8fdd87eadc6f106.sam@gentoo
1 commit: 34abc17c83bc4e9425e34cbfe8fdd87eadc6f106
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jun 30 16:56:14 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Thu Jun 30 16:56:50 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=34abc17c
7
8 dev-python/QtPy: allow Python 3.11 for pyside2/shiboken
9
10 Signed-off-by: Sam James <sam <AT> gentoo.org>
11
12 dev-python/QtPy/QtPy-2.1.0-r2.ebuild | 142 +++++++++++++++++++++++++++++++++++
13 1 file changed, 142 insertions(+)
14
15 diff --git a/dev-python/QtPy/QtPy-2.1.0-r2.ebuild b/dev-python/QtPy/QtPy-2.1.0-r2.ebuild
16 new file mode 100644
17 index 000000000000..b68d19eaa03b
18 --- /dev/null
19 +++ b/dev-python/QtPy/QtPy-2.1.0-r2.ebuild
20 @@ -0,0 +1,142 @@
21 +# Copyright 1999-2022 Gentoo Authors
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +EAPI=8
25 +
26 +DISTUTILS_USE_PEP517=setuptools
27 +PYTHON_COMPAT=( python3_{8..11} )
28 +
29 +inherit distutils-r1 virtualx
30 +
31 +DESCRIPTION="Abstraction layer on top of PyQt5 and PySide2 and additional custom QWidgets"
32 +HOMEPAGE="
33 + https://github.com/spyder-ide/qtpy/
34 + https://pypi.org/project/QtPy/
35 +"
36 +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
37 +
38 +LICENSE="MIT"
39 +SLOT="0"
40 +KEYWORDS="~amd64 ~arm ~arm64 ~x86"
41 +
42 +_IUSE_QT_MODULES="
43 + declarative designer gui help location multimedia network opengl
44 + positioning printsupport sensors serialport speech sql svg testlib
45 + webchannel webengine websockets widgets x11extras xml xmlpatterns
46 +"
47 +IUSE="+pyqt5 pyside2 ${_IUSE_QT_MODULES}"
48 +unset _IUSE_QT_MODULES
49 +
50 +REQUIRED_USE="
51 + || ( pyqt5 pyside2 )
52 + python_targets_python3_11? ( pyqt5 !pyside2 )
53 +"
54 +
55 +# These flags are currently *not* common to both the PySide2 and PyQt5 ebuild
56 +# Disable them for now, please check periodically if this is still up to date.
57 +# bluetooth? ( pyqt5 )
58 +# dbus? ( pyqt5 )
59 +#
60 +# 3d? ( pyside2 )
61 +# charts? ( pyside2 )
62 +# concurrent? ( pyside2 )
63 +# datavis? ( pyside2 )
64 +# scxml? ( pyside2 )
65 +# script? ( pyside2 )
66 +# scripttools? ( pyside2 )
67 +
68 +# WARNING: the obvious solution of using || for PyQt5/pyside2 is not going
69 +# to work. The package only checks whether PyQt5/pyside2 is installed, it does
70 +# not verify whether they have the necessary modules (i.e. satisfy the USE dep).
71 +#
72 +# Webengine is a special case, because PyQt5 provides this in a separate package
73 +# while PySide2 ships it in the same package.
74 +#
75 +# declarative/qml/quick is a special case, because PyQt5 bundles the bindings
76 +# for qml and quick in one flag: declarative PySide2 does not.
77 +#
78 +# The PyQt5 ebuild currently enables xml support unconditionally, the flag is
79 +# added anyway with a (+) to make it future proof if the ebuild were to change
80 +# this behaviour in the future.
81 +#
82 +# The PySide2 ebuild currently enables opengl and serialport support
83 +# unconditionally, the flag is added anyway with a (+) to make it future proof
84 +# if the ebuild were to change this behaviour in the future.
85 +RDEPEND="
86 + dev-python/packaging[${PYTHON_USEDEP}]
87 + pyqt5? (
88 + dev-python/PyQt5[${PYTHON_USEDEP}]
89 + dev-python/PyQt5[declarative?,designer?,gui?,help?,location?]
90 + dev-python/PyQt5[multimedia?,network?,opengl?,positioning?]
91 + dev-python/PyQt5[printsupport?,sensors?,serialport?,speech(-)?,sql?,svg?]
92 + dev-python/PyQt5[testlib?,webchannel?,websockets?,widgets?]
93 + dev-python/PyQt5[x11extras?,xml(+)?,xmlpatterns?]
94 + webengine? ( dev-python/PyQtWebEngine[${PYTHON_USEDEP}] )
95 + )
96 + pyside2? (
97 + dev-python/pyside2[${PYTHON_USEDEP}]
98 + dev-python/pyside2[designer?,gui?,help?,location?,multimedia?]
99 + dev-python/pyside2[network?,opengl(+)?,positioning?,printsupport?]
100 + dev-python/pyside2[sensors?,serialport(+)?,speech?,sql?,svg?]
101 + dev-python/pyside2[testlib?,webchannel?,webengine?,websockets?]
102 + dev-python/pyside2[widgets?,x11extras?,xml?,xmlpatterns?]
103 + declarative? ( dev-python/pyside2[qml,quick] )
104 + )
105 +"
106 +
107 +# The QtPy testsuite skips tests for bindings that are not installed, so here we
108 +# ensure that everything is available and all tests are run. Note that not
109 +# all flags are available in PyQt5/PySide2, so some tests are still skipped.
110 +BDEPEND="
111 + test? (
112 + dev-python/mock[${PYTHON_USEDEP}]
113 + pyqt5? (
114 + dev-python/PyQt5[${PYTHON_USEDEP}]
115 + dev-python/PyQt5[bluetooth,dbus,declarative,designer,gui,help,location]
116 + dev-python/PyQt5[multimedia,network,opengl,positioning,printsupport]
117 + dev-python/PyQt5[sensors,serialport,speech(-),sql,svg,testlib,webchannel]
118 + dev-python/PyQt5[websockets,widgets,x11extras,xml(+),xmlpatterns]
119 + dev-python/PyQtWebEngine[${PYTHON_USEDEP}]
120 + )
121 + pyside2? (
122 + dev-python/pyside2[${PYTHON_USEDEP}]
123 + dev-python/pyside2[3d,charts,concurrent,datavis,designer,gui,help]
124 + dev-python/pyside2[location,multimedia,network,opengl(+),positioning]
125 + dev-python/pyside2[printsupport,qml,quick,script,scripttools,scxml]
126 + dev-python/pyside2[sensors,serialport(+),speech,sql,svg,testlib]
127 + dev-python/pyside2[webchannel,webengine,websockets,widgets,x11extras]
128 + dev-python/pyside2[xml,xmlpatterns]
129 + )
130 + )
131 +"
132 +
133 +distutils_enable_tests pytest
134 +
135 +src_prepare() {
136 + distutils-r1_src_prepare
137 + sed -i -e 's:--cov=qtpy --cov-report=term-missing::' pytest.ini || die
138 + # Disable Qt for Python implementations that are not selected
139 + if ! use pyqt5; then
140 + sed -i -e "s/from PyQt5.QtCore import/raise ImportError #/" qtpy/__init__.py || die
141 + fi
142 + if ! use pyside2; then
143 + sed -i -e "s/from PySide2 import/raise ImportError #/" qtpy/__init__.py || die
144 + sed -i -e "s/from PySide2.QtCore import/raise ImportError #/" qtpy/__init__.py || die
145 + fi
146 +}
147 +
148 +python_test() {
149 + if use pyqt5; then
150 + QT_API="pyqt5" virtx epytest
151 + fi
152 + if use pyside2; then
153 + QT_API="pyside2" virtx epytest
154 + fi
155 +}
156 +
157 +pkg_postinst() {
158 + if use pyqt5 && use pyside2; then
159 + ewarn "You have enabled both PyQt5 and PySide2, note that QtPy will default"
160 + ewarn "to PyQt5 unless the QT_API environment variable overrides this."
161 + fi
162 +}