Gentoo Archives: gentoo-commits

From: Andrew Ammerlaan <andrewammerlaan@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/QtPy/
Date: Mon, 04 Oct 2021 19:57:03
Message-Id: 1633377418.e57c8003037eebb728de70fa6ad16b437bdcf71d.andrewammerlaan@gentoo
1 commit: e57c8003037eebb728de70fa6ad16b437bdcf71d
2 Author: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
3 AuthorDate: Mon Oct 4 19:56:50 2021 +0000
4 Commit: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
5 CommitDate: Mon Oct 4 19:56:58 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e57c8003
7
8 dev-python/QtPy: add version 1.11.2
9
10 Package-Manager: Portage-3.0.26, Repoman-3.0.3
11 Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>
12
13 dev-python/QtPy/Manifest | 1 +
14 dev-python/QtPy/QtPy-1.11.2.ebuild | 158 +++++++++++++++++++++++++++++++++++++
15 2 files changed, 159 insertions(+)
16
17 diff --git a/dev-python/QtPy/Manifest b/dev-python/QtPy/Manifest
18 index 2f2e5c04e36..34a411739e0 100644
19 --- a/dev-python/QtPy/Manifest
20 +++ b/dev-python/QtPy/Manifest
21 @@ -1,3 +1,4 @@
22 DIST QtPy-1.10.0.tar.gz 34339 BLAKE2B cbae5eb38bf8ee4ab1528bca0afa93c57b70f48eb44639eac04344f4bbef28a4277bd3727ed5ac25f8ef18cc5391fafd33bb8ea42037eabee10cd4d13d7d3d1c SHA512 5ca326ae64cc85b48b02daa344d23387a9165a0097d59c31d921c7f67141afe31dad8a46abd0b201b31446f97405d7dce4dacd936b24c5faf9484dc37665e974
23 DIST QtPy-1.11.1.tar.gz 37068 BLAKE2B 5eef91a8aaad5d8354d123481e434a2b32b1aa1eddd4b6cc0205a40249533c2f6211b13ea049485243e510b0d820c35f0f5833df4c42276d15f3f8269cff3604 SHA512 467780e353b9658234cc164a11bc1526165a31a2021fd75efdd109ea516de5f279bb601130c98fd295aba99c40f20ab3d2c4758951180d4dc05e47bbc3e8408c
24 +DIST QtPy-1.11.2.tar.gz 37098 BLAKE2B 8806cce798c4c2d885dd340d0d077567353cf0f3f1c2b284fd788c190b28b6133d052d31dea861e7d2497d0db88ba7ce8be83074360c61823f7a78dc01c015a5 SHA512 e49beb3180789a8080a19406b0e122bc9fc2192ac89b59f0956d7c65ac957779b192062956a97a7526f32724000df18abf32ddd6bda52f9cdf440ddc551887f8
25 DIST QtPy-1.9.0.tar.gz 35522 BLAKE2B 05b700c1f804cc535c3065c8f819d1d7fb0e02d43f199082d2e0d2c575ff8dbfdbf0053ddb3b155108cf55350ff4daf75166ab39a60374a35a86a1707724a4a1 SHA512 2492c531f0df3afc9e0f8875a2b2e39cc8b09542fb9f251900b8596c0db7767390bb85365cc39efd6cd37ae852a00655354e6f9f3d795023e4fd86dbf8bd5fa7
26
27 diff --git a/dev-python/QtPy/QtPy-1.11.2.ebuild b/dev-python/QtPy/QtPy-1.11.2.ebuild
28 new file mode 100644
29 index 00000000000..4f256a44dd5
30 --- /dev/null
31 +++ b/dev-python/QtPy/QtPy-1.11.2.ebuild
32 @@ -0,0 +1,158 @@
33 +# Copyright 1999-2021 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=8
37 +
38 +PYTHON_COMPAT=( python3_{8..10} )
39 +
40 +inherit distutils-r1 virtualx
41 +
42 +DESCRIPTION="Abstraction layer on top of PyQt5 and PySide2 and additional custom QWidgets"
43 +HOMEPAGE="https://github.com/spyder-ide/qtpy/"
44 +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
45 +
46 +LICENSE="MIT"
47 +SLOT="0"
48 +KEYWORDS="~amd64 ~arm64 ~x86"
49 +
50 +_IUSE_QT_MODULES="
51 + declarative designer gui help location multimedia network opengl
52 + positioning printsupport sensors serialport speech sql svg testlib
53 + webchannel webengine websockets widgets x11extras xml xmlpatterns
54 +"
55 +IUSE="+pyqt5 pyside2 ${_IUSE_QT_MODULES}"
56 +unset _IUSE_QT_MODULES
57 +
58 +# PySide2 does not support python3_10, nor is it likely that it will in the
59 +# future since upstream appears to be focussing on PySide6 for Qt6 instead
60 +# (which is compatible with python3_10). So if we want to use python3_10
61 +# we have to force disable pyside2.
62 +REQUIRED_USE="
63 + || ( pyqt5 pyside2 )
64 + python_targets_python3_10? ( pyqt5 !pyside2 )
65 +"
66 +
67 +# These flags are currently *not* common to both the PySide2 and PyQt5 ebuild
68 +# Disable them for now, please check periodically if this is still up to date.
69 +# bluetooth? ( pyqt5 )
70 +# dbus? ( pyqt5 )
71 +#
72 +# 3d? ( pyside2 )
73 +# charts? ( pyside2 )
74 +# concurrent? ( pyside2 )
75 +# datavis? ( pyside2 )
76 +# scxml? ( pyside2 )
77 +# script? ( pyside2 )
78 +# scripttools? ( pyside2 )
79 +
80 +# WARNING: the obvious solution of using || for PyQt5/pyside2 is not going
81 +# to work. The package only checks whether PyQt5/pyside2 is installed, it does
82 +# not verify whether they have the necessary modules (i.e. satisfy the USE dep).
83 +#
84 +# Webengine is a special case, because PyQt5 provides this in a separate package
85 +# while PySide2 ships it in the same package.
86 +#
87 +# declarative/qml/quick is a special case, because PyQt5 bundles the bindings
88 +# for qml and quick in one flag: declarative PySide2 does not.
89 +#
90 +# The PyQt5 ebuild currently enables xml support unconditionally, the flag is
91 +# added anyway with a (+) to make it future proof if the ebuild were to change
92 +# this behaviour in the future.
93 +#
94 +# The PySide2 ebuild currently enables opengl and serialport support
95 +# unconditionally, the flag is added anyway with a (+) to make it future proof
96 +# if the ebuild were to change this behaviour in the future.
97 +RDEPEND="
98 + pyqt5? (
99 + dev-python/PyQt5[${PYTHON_USEDEP}]
100 + dev-python/PyQt5[declarative?,designer?,gui?,help?,location?]
101 + dev-python/PyQt5[multimedia?,network?,opengl?,positioning?]
102 + dev-python/PyQt5[printsupport?,sensors?,serialport?,speech(-)?,sql?,svg?]
103 + dev-python/PyQt5[testlib?,webchannel?,websockets?,widgets?]
104 + dev-python/PyQt5[x11extras?,xml(+)?,xmlpatterns?]
105 + webengine? ( dev-python/PyQtWebEngine[${PYTHON_USEDEP}] )
106 + )
107 + pyside2? (
108 + $(python_gen_cond_dep '
109 + dev-python/pyside2[${PYTHON_USEDEP}]
110 + dev-python/pyside2[designer?,gui?,help?,location?,multimedia?]
111 + dev-python/pyside2[network?,opengl(+)?,positioning?,printsupport?]
112 + dev-python/pyside2[sensors?,serialport(+)?,speech?,sql?,svg?]
113 + dev-python/pyside2[testlib?,webchannel?,webengine?,websockets?]
114 + dev-python/pyside2[widgets?,x11extras?,xml?,xmlpatterns?]
115 + declarative? ( dev-python/pyside2[qml,quick] )
116 + ' python3_{7..9} )
117 + )
118 +"
119 +
120 +# The QtPy testsuite skips tests for bindings that are not installed, so here we
121 +# ensure that everything is available and all tests are run. Note that not
122 +# all flags are available in PyQt5/PySide2, so some tests are still skipped.
123 +BDEPEND="
124 + test? (
125 + dev-python/mock[${PYTHON_USEDEP}]
126 + pyqt5? (
127 + dev-python/PyQt5[${PYTHON_USEDEP}]
128 + dev-python/PyQt5[bluetooth,dbus,declarative,designer,gui,help,location]
129 + dev-python/PyQt5[multimedia,network,opengl,positioning,printsupport]
130 + dev-python/PyQt5[sensors,serialport,speech(-),sql,svg,testlib,webchannel]
131 + dev-python/PyQt5[websockets,widgets,x11extras,xml(+),xmlpatterns]
132 + dev-python/PyQtWebEngine[${PYTHON_USEDEP}]
133 + )
134 + pyside2? (
135 + $(python_gen_cond_dep '
136 + dev-python/pyside2[${PYTHON_USEDEP}]
137 + dev-python/pyside2[3d,charts,concurrent,datavis,designer,gui,help]
138 + dev-python/pyside2[location,multimedia,network,opengl(+),positioning]
139 + dev-python/pyside2[printsupport,qml,quick,script,scripttools,scxml]
140 + dev-python/pyside2[sensors,serialport(+),speech,sql,svg,testlib]
141 + dev-python/pyside2[webchannel,webengine,websockets,widgets,x11extras]
142 + dev-python/pyside2[xml,xmlpatterns]
143 + ' python3_{7..9} )
144 + )
145 + )
146 +"
147 +
148 +distutils_enable_tests pytest
149 +
150 +src_prepare() {
151 + default
152 + # Disale Qt for Python implementations that are not selected
153 + if ! use pyqt5; then
154 + sed -i -e "s/from PyQt5.QtCore import/raise ImportError #/" qtpy/__init__.py || die
155 + fi
156 + if ! use pyside2; then
157 + sed -i -e "s/from PySide2 import/raise ImportError #/" qtpy/__init__.py || die
158 + sed -i -e "s/from PySide2.QtCore import/raise ImportError #/" qtpy/__init__.py || die
159 + fi
160 +
161 + # Disable outdated PyQt4 and PySide
162 + sed -i -e "s/from PyQt4.Qt import/raise ImportError #/" qtpy/__init__.py || die
163 + sed -i -e "s/from PyQt4.QtCore import/raise ImportError #/" qtpy/__init__.py || die
164 + sed -i -e "s/from PySide import/raise ImportError #/" qtpy/__init__.py || die
165 + sed -i -e "s/from PySide.QtCore import/raise ImportError #/" qtpy/__init__.py || die
166 +}
167 +
168 +src_test() {
169 + virtx python_foreach_impl python_test
170 +}
171 +
172 +python_test() {
173 + if use pyqt5; then
174 + QT_API="pyqt5" epytest
175 + fi
176 + if use pyside2; then
177 + if [[ "${EPYTHON}" == "python3.10" ]]; then
178 + return
179 + else
180 + QT_API="pyside2" epytest
181 + fi
182 + fi
183 +}
184 +
185 +pkg_postinst() {
186 + if use pyqt5 && use pyside2; then
187 + ewarn "You have enabled both PyQt5 and PySide2, note that QtPy will default"
188 + ewarn "to PyQt5 unless the QT_API environment variable overrides this."
189 + fi
190 +}