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: Sat, 19 Feb 2022 11:12:32
Message-Id: 1645269140.d7e3ecb0e61e5978852f25cccce5f0317fb24b9d.andrewammerlaan@gentoo
1 commit: d7e3ecb0e61e5978852f25cccce5f0317fb24b9d
2 Author: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
3 AuthorDate: Sat Feb 19 11:07:44 2022 +0000
4 Commit: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
5 CommitDate: Sat Feb 19 11:12:20 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d7e3ecb0
7
8 dev-python/QtPy: add version 2.0.1
9
10 Package-Manager: Portage-3.0.30, 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-2.0.1.ebuild | 140 ++++++++++++++++++++++++++++++++++++++
15 2 files changed, 141 insertions(+)
16
17 diff --git a/dev-python/QtPy/Manifest b/dev-python/QtPy/Manifest
18 index 724b914aaef8..6bb3ddeff649 100644
19 --- a/dev-python/QtPy/Manifest
20 +++ b/dev-python/QtPy/Manifest
21 @@ -1,3 +1,4 @@
22 DIST QtPy-1.11.2.tar.gz 37098 BLAKE2B 8806cce798c4c2d885dd340d0d077567353cf0f3f1c2b284fd788c190b28b6133d052d31dea861e7d2497d0db88ba7ce8be83074360c61823f7a78dc01c015a5 SHA512 e49beb3180789a8080a19406b0e122bc9fc2192ac89b59f0956d7c65ac957779b192062956a97a7526f32724000df18abf32ddd6bda52f9cdf440ddc551887f8
23 DIST QtPy-1.11.3.tar.gz 39637 BLAKE2B d1bfa0944dcebf5e408b9a061bcc6bab2fe172a70f0eadd36b229d2c9b40d74d8159c820608d3afd71a91085d5703af9b7045f359209730c53a9a83007159ce5 SHA512 461d858b05ff75f27017f6f0058f3e47643d5fe6c236e4307fa006735ad80e4c1fa487f1ab75edcfe881026541e302cdc3f8221c4ad7b97bce8c96b66db580bb
24 DIST QtPy-2.0.0.tar.gz 39628 BLAKE2B bc1b2cf975c3457cb026016854ec70e0aa3247c1234643dbf95681f655678e43ba0200b26e16a0b9eafd6fb373c1f876d9a54458ceb9b9b035ad463b7874db2c SHA512 95855c305da7f54850bcb6297a1f12ceda79eaf6d9b01771b1391d2d7b07b8f690e134cc2d52417bcc320395dce8c1f7f5c6ccadf2939db196e0ed5441215d5a
25 +DIST QtPy-2.0.1.tar.gz 43047 BLAKE2B 66625852e75fbfcf0bf96e740754ca26b6d5226dd5450d0274cf6dc875cba18e5ed8e339c8c7ad084ffa9b135f19447e087b338690ec521205316c4f22f09197 SHA512 5d482b0a5bd2be67a0fabccf98a9dedf28ef328641c8c976e2274d4a5afb14b9fefce251e80496ed54425dcb3da24984c6c36308db0bfc810ea2142528ad88fd
26
27 diff --git a/dev-python/QtPy/QtPy-2.0.1.ebuild b/dev-python/QtPy/QtPy-2.0.1.ebuild
28 new file mode 100644
29 index 000000000000..3013f6cdc707
30 --- /dev/null
31 +++ b/dev-python/QtPy/QtPy-2.0.1.ebuild
32 @@ -0,0 +1,140 @@
33 +# Copyright 1999-2022 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 ~arm ~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 +REQUIRED_USE="|| ( pyqt5 pyside2 )"
59 +
60 +# These flags are currently *not* common to both the PySide2 and PyQt5 ebuild
61 +# Disable them for now, please check periodically if this is still up to date.
62 +# bluetooth? ( pyqt5 )
63 +# dbus? ( pyqt5 )
64 +#
65 +# 3d? ( pyside2 )
66 +# charts? ( pyside2 )
67 +# concurrent? ( pyside2 )
68 +# datavis? ( pyside2 )
69 +# scxml? ( pyside2 )
70 +# script? ( pyside2 )
71 +# scripttools? ( pyside2 )
72 +
73 +# WARNING: the obvious solution of using || for PyQt5/pyside2 is not going
74 +# to work. The package only checks whether PyQt5/pyside2 is installed, it does
75 +# not verify whether they have the necessary modules (i.e. satisfy the USE dep).
76 +#
77 +# Webengine is a special case, because PyQt5 provides this in a separate package
78 +# while PySide2 ships it in the same package.
79 +#
80 +# declarative/qml/quick is a special case, because PyQt5 bundles the bindings
81 +# for qml and quick in one flag: declarative PySide2 does not.
82 +#
83 +# The PyQt5 ebuild currently enables xml support unconditionally, the flag is
84 +# added anyway with a (+) to make it future proof if the ebuild were to change
85 +# this behaviour in the future.
86 +#
87 +# The PySide2 ebuild currently enables opengl and serialport support
88 +# unconditionally, the flag is added anyway with a (+) to make it future proof
89 +# if the ebuild were to change this behaviour in the future.
90 +RDEPEND="
91 + dev-python/packaging[${PYTHON_USEDEP}]
92 + pyqt5? (
93 + dev-python/PyQt5[${PYTHON_USEDEP}]
94 + dev-python/PyQt5[declarative?,designer?,gui?,help?,location?]
95 + dev-python/PyQt5[multimedia?,network?,opengl?,positioning?]
96 + dev-python/PyQt5[printsupport?,sensors?,serialport?,speech(-)?,sql?,svg?]
97 + dev-python/PyQt5[testlib?,webchannel?,websockets?,widgets?]
98 + dev-python/PyQt5[x11extras?,xml(+)?,xmlpatterns?]
99 + webengine? ( dev-python/PyQtWebEngine[${PYTHON_USEDEP}] )
100 + )
101 + pyside2? (
102 + dev-python/pyside2[${PYTHON_USEDEP}]
103 + dev-python/pyside2[designer?,gui?,help?,location?,multimedia?]
104 + dev-python/pyside2[network?,opengl(+)?,positioning?,printsupport?]
105 + dev-python/pyside2[sensors?,serialport(+)?,speech?,sql?,svg?]
106 + dev-python/pyside2[testlib?,webchannel?,webengine?,websockets?]
107 + dev-python/pyside2[widgets?,x11extras?,xml?,xmlpatterns?]
108 + declarative? ( dev-python/pyside2[qml,quick] )
109 + )
110 +"
111 +
112 +# The QtPy testsuite skips tests for bindings that are not installed, so here we
113 +# ensure that everything is available and all tests are run. Note that not
114 +# all flags are available in PyQt5/PySide2, so some tests are still skipped.
115 +BDEPEND="
116 + test? (
117 + dev-python/mock[${PYTHON_USEDEP}]
118 + pyqt5? (
119 + dev-python/PyQt5[${PYTHON_USEDEP}]
120 + dev-python/PyQt5[bluetooth,dbus,declarative,designer,gui,help,location]
121 + dev-python/PyQt5[multimedia,network,opengl,positioning,printsupport]
122 + dev-python/PyQt5[sensors,serialport,speech(-),sql,svg,testlib,webchannel]
123 + dev-python/PyQt5[websockets,widgets,x11extras,xml(+),xmlpatterns]
124 + dev-python/PyQtWebEngine[${PYTHON_USEDEP}]
125 + )
126 + pyside2? (
127 + dev-python/pyside2[${PYTHON_USEDEP}]
128 + dev-python/pyside2[3d,charts,concurrent,datavis,designer,gui,help]
129 + dev-python/pyside2[location,multimedia,network,opengl(+),positioning]
130 + dev-python/pyside2[printsupport,qml,quick,script,scripttools,scxml]
131 + dev-python/pyside2[sensors,serialport(+),speech,sql,svg,testlib]
132 + dev-python/pyside2[webchannel,webengine,websockets,widgets,x11extras]
133 + dev-python/pyside2[xml,xmlpatterns]
134 + )
135 + )
136 +"
137 +
138 +distutils_enable_tests pytest
139 +
140 +src_prepare() {
141 + default
142 + # Disale Qt for Python implementations that are not selected
143 + if ! use pyqt5; then
144 + sed -i -e "s/from PyQt5.QtCore import/raise ImportError #/" qtpy/__init__.py || die
145 + fi
146 + if ! use pyside2; then
147 + sed -i -e "s/from PySide2 import/raise ImportError #/" qtpy/__init__.py || die
148 + sed -i -e "s/from PySide2.QtCore import/raise ImportError #/" qtpy/__init__.py || die
149 + fi
150 +
151 + # Disable outdated PyQt4 and PySide
152 + sed -i -e "s/from PyQt4.Qt import/raise ImportError #/" qtpy/__init__.py || die
153 + sed -i -e "s/from PyQt4.QtCore import/raise ImportError #/" qtpy/__init__.py || die
154 + sed -i -e "s/from PySide import/raise ImportError #/" qtpy/__init__.py || die
155 + sed -i -e "s/from PySide.QtCore import/raise ImportError #/" qtpy/__init__.py || die
156 +}
157 +
158 +python_test() {
159 + if use pyqt5; then
160 + QT_API="pyqt5" virtx epytest
161 + fi
162 + if use pyside2; then
163 + QT_API="pyside2" virtx epytest
164 + fi
165 +}
166 +
167 +pkg_postinst() {
168 + if use pyqt5 && use pyside2; then
169 + ewarn "You have enabled both PyQt5 and PySide2, note that QtPy will default"
170 + ewarn "to PyQt5 unless the QT_API environment variable overrides this."
171 + fi
172 +}