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