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