dev-python/QtPy: drop netwrokauth and webkit flag, add py3.{9,10}

- PySide2 is not compatible with python3.10, to add python3.10
to this package anyway we need to force disable pyside2 if
we want to use python_targets_python3_10.

- To accomadate this we have to rewrite the test suite to
support running if one of the two implementations is
disabled. Otherwise tests would fail with USE="pyqt5 -pyside2
python_targets_python3_10: due to ImportErrors that we
explicitly introduced in the prepare phase with USE="-pyside2"

Closes: https://bugs.gentoo.org/780330
Package-Manager: Portage-3.0.19, Repoman-3.0.3
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
This commit is contained in:
Andrew Ammerlaan
2021-05-29 10:36:55 +02:00
parent 941761bdef
commit 83cdaf684e
3 changed files with 65 additions and 28 deletions

View File

@@ -30,7 +30,11 @@ RDEPEND="
BDEPEND="
test? (
dev-python/mock[${PYTHON_USEDEP}]
dev-python/PyQt5[${PYTHON_USEDEP},bluetooth,dbus,declarative,designer,gui,help,location,multimedia,network,networkauth,opengl,positioning,printsupport,sensors,serialport,sql,ssl,svg,testlib,webchannel,webkit,websockets,widgets,x11extras,xml(+),xmlpatterns]
dev-python/PyQt5[${PYTHON_USEDEP}]
dev-python/PyQt5[bluetooth,dbus,declarative,designer,gui,help,location]
dev-python/PyQt5[multimedia,network,opengl,positioning,printsupport]
dev-python/PyQt5[sensors,serialport,sql,svg,testlib,webchannel]
dev-python/PyQt5[websockets,widgets,x11extras,xml(+),xmlpatterns]
dev-python/PyQtWebEngine[${PYTHON_USEDEP}]
)"
@@ -40,6 +44,7 @@ src_prepare() {
default
sed -i -e "s/from PyQt4.Qt import/raise ImportError #/" qtpy/__init__.py || die
sed -i -e "s/from PyQt4.QtCore import/raise ImportError #/" qtpy/__init__.py || die
sed -i -e "s/from PySide import/raise ImportError #/" qtpy/__init__.py || die
sed -i -e "s/from PySide2 import/raise ImportError #/" qtpy/__init__.py || die
}

View File

@@ -3,7 +3,7 @@
EAPI=7
PYTHON_COMPAT=( python3_{7..8} )
PYTHON_COMPAT=( python3_{7..10} )
inherit distutils-r1 virtualx
@@ -23,17 +23,19 @@ _IUSE_QT_MODULES="
IUSE="+pyqt5 pyside2 ${_IUSE_QT_MODULES}"
unset _IUSE_QT_MODULES
# PySide2 does not support python3_10, nor is it likely that it will in the
# future since upstream appears to be focussing on PySide6 for Qt6 instead
# (which is compatible with python3_10). So if we want to use python3_10
# we have to force disable pyside2.
REQUIRED_USE="
|| ( pyqt5 pyside2 )
test? ( pyqt5 pyside2 )
python_targets_python3_10? ( pyqt5 !pyside2 )
"
# These flags are currently *not* common to both the PySide2 and PyQt5 ebuild
# Disable them for now, please check periodically if this is still up to date.
# bluetooth? ( pyqt5 )
# dbus? ( pyqt5 )
# networkauth? ( pyqt5 )
# webkit? ( pyqt5 )
#
# 3d? ( pyside2 )
# charts? ( pyside2 )
@@ -72,13 +74,15 @@ RDEPEND="
webengine? ( dev-python/PyQtWebEngine[${PYTHON_USEDEP}] )
)
pyside2? (
dev-python/pyside2[${PYTHON_USEDEP}]
dev-python/pyside2[designer?,gui?,help?,location?,multimedia?]
dev-python/pyside2[network?,opengl(+)?,positioning?,printsupport?]
dev-python/pyside2[sensors?,serialport(+)?,sql?,svg?,testlib?]
dev-python/pyside2[webchannel?,webengine?,websockets?,widgets?]
dev-python/pyside2[x11extras?,xml?,xmlpatterns?]
declarative? ( dev-python/pyside2[qml,quick] )
$(python_gen_cond_dep '
dev-python/pyside2[${PYTHON_USEDEP}]
dev-python/pyside2[designer?,gui?,help?,location?,multimedia?]
dev-python/pyside2[network?,opengl(+)?,positioning?,printsupport?]
dev-python/pyside2[sensors?,serialport(+)?,sql?,svg?,testlib?]
dev-python/pyside2[webchannel?,webengine?,websockets?,widgets?]
dev-python/pyside2[x11extras?,xml?,xmlpatterns?]
declarative? ( dev-python/pyside2[qml,quick] )
' python3_{7..9} )
)
"
@@ -90,22 +94,29 @@ BDEPEND="
dev-python/mock[${PYTHON_USEDEP}]
dev-python/PyQt5[${PYTHON_USEDEP}]
dev-python/PyQt5[bluetooth,dbus,declarative,designer,gui,help,location]
dev-python/PyQt5[multimedia,network,networkauth,opengl,positioning]
dev-python/PyQt5[printsupport,sensors,serialport,sql,svg,testlib]
dev-python/PyQt5[webchannel,websockets,widgets,x11extras,xml(+)]
dev-python/PyQt5[xmlpatterns]
dev-python/PyQt5[multimedia,network,opengl,positioning,printsupport]
dev-python/PyQt5[sensors,serialport,sql,svg,testlib,webchannel]
dev-python/PyQt5[websockets,widgets,x11extras,xml(+),xmlpatterns]
dev-python/PyQtWebEngine[${PYTHON_USEDEP}]
dev-python/pyside2[${PYTHON_USEDEP}]
dev-python/pyside2[3d,charts,concurrent,datavis,designer,gui,help]
dev-python/pyside2[location,multimedia,network,opengl(+),positioning]
dev-python/pyside2[printsupport,qml,quick,script,scripttools,scxml]
dev-python/pyside2[sensors,serialport(+),speech,sql,svg,testlib]
dev-python/pyside2[webchannel,webengine,websockets,widgets,x11extras]
dev-python/pyside2[xml,xmlpatterns]
)"
$(python_gen_cond_dep '
dev-python/pyside2[${PYTHON_USEDEP}]
dev-python/pyside2[3d,charts,concurrent,datavis,designer,gui,help]
dev-python/pyside2[location,multimedia,network,opengl(+),positioning]
dev-python/pyside2[printsupport,qml,quick,script,scripttools,scxml]
dev-python/pyside2[sensors,serialport(+),speech,sql,svg,testlib]
dev-python/pyside2[webchannel,webengine,websockets,widgets,x11extras]
dev-python/pyside2[xml,xmlpatterns]
' python3_{7..9} )
)
"
distutils_enable_tests pytest
# https://github.com/spyder-ide/qtpy/issues/238
PATCHES=(
"${FILESDIR}/${P}-python3_9.patch"
)
src_prepare() {
default
if ! use pyqt5; then
@@ -113,12 +124,14 @@ src_prepare() {
fi
if ! use pyside2; then
sed -i -e "s/from PySide2 import/raise ImportError #/" qtpy/__init__.py || die
sed -i -e "s/from PySide2.QtCore import/raise ImportError #/" qtpy/__init__.py || die
fi
# Disable outdated PyQt4 and PySide
sed -i -e "s/from PyQt4.Qt import/raise ImportError #/" qtpy/__init__.py || die
sed -i -e "s/from PyQt4.QtCore import/raise ImportError #/" qtpy/__init__.py || die
sed -i -e "s/from PySide import/raise ImportError #/" qtpy/__init__.py || die
sed -i -e "s/from PySide.QtCore import/raise ImportError #/" qtpy/__init__.py || die
}
src_test() {
@@ -126,10 +139,16 @@ src_test() {
}
python_test() {
local -x QT_API
for QT_API in pyqt5 pyside2; do
epytest
done
if use pyqt5; then
QT_API="pyqt5" epytest
fi
if use pyside2; then
if [[ "${EPYTHON}" == "python3.10" ]]; then
return
else
QT_API="pyside2" epytest
fi
fi
}
pkg_postinst() {

View File

@@ -0,0 +1,13 @@
diff --git a/qtpy/uic.py b/qtpy/uic.py
index 07d7a78..84525ab 100644
--- a/qtpy/uic.py
+++ b/qtpy/uic.py
@@ -181,7 +181,7 @@ else:
custom_widget_classes = {}
- for custom_widget in custom_widgets.getchildren():
+ for custom_widget in list(custom_widgets):
cw_class = custom_widget.find('class').text
cw_header = custom_widget.find('header').text