Gentoo Archives: gentoo-commits

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