# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 DISTUTILS_EXT=1 DISTUTILS_USE_PEP517=sip PYPI_NO_NORMALIZE=1 PYPI_PN=PyQt5 PYTHON_COMPAT=( python3_{12..14} ) # qmake-utils defines qt5_get_bindir and qt5_get_qmake_args, used below, # only for EAPI 8; pkgcheck's UnusedInherits misses functions defined # under that condition, so the finding is false. EAPI 9 would lose them. # verified 2026-10-03 inherit distutils-r1 flag-o-matic multiprocessing pypi qmake-utils DESCRIPTION="Python bindings for the Qt framework" HOMEPAGE="https://www.riverbankcomputing.com/software/pyqt/" LICENSE="GPL-3" SLOT="0" KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86" # ::gentoo's desktop profile enabled gui, multimedia, network, printsupport # and widgets for pyqt5 (bug #540046) until its Qt5 cleanup of 2026-05-23. # Without that entry the desktop profiles fail REQUIRED_USE. Portage would # read the same line from this repository's profiles/package.use, but # pkgcore and pkgcheck ignore that file, so all but multimedia are IUSE # defaults here; no consumer in this overlay needs multimedia. # verified 2026-10-03 IUSE=" dbus debug declarative examples gles2-only +gui multimedia +network opengl +printsupport sql +ssl svg testlib +widgets x11extras " # Derived from project.py qmake_QT declarations and SIP imports. REQUIRED_USE=" declarative? ( gui network ) multimedia? ( gui network ) opengl? ( gui widgets ) printsupport? ( gui widgets ) sql? ( widgets ) svg? ( gui widgets ) testlib? ( widgets ) widgets? ( gui ) " DEPEND=" >=dev-qt/qtcore-5.15:5 >=dev-qt/qtxml-5.15:5 dbus? ( dev-python/dbus-python[${PYTHON_USEDEP}] >=dev-qt/qtdbus-5.15:5 sys-apps/dbus ) declarative? ( >=dev-qt/qtdeclarative-5.15:5[widgets?] ) gui? ( >=dev-qt/qtgui-5.15:5[gles2-only=] ) multimedia? ( >=dev-qt/qtmultimedia-5.15:5[widgets?] ) network? ( >=dev-qt/qtnetwork-5.15:5[ssl=] ) opengl? ( >=dev-qt/qtopengl-5.15:5 ) printsupport? ( >=dev-qt/qtprintsupport-5.15:5 ) sql? ( >=dev-qt/qtsql-5.15:5 ) svg? ( >=dev-qt/qtsvg-5.15:5 ) testlib? ( >=dev-qt/qttest-5.15:5 ) widgets? ( >=dev-qt/qtwidgets-5.15:5 ) x11extras? ( >=dev-qt/qtx11extras-5.15:5 ) " RDEPEND="${DEPEND} >=dev-python/pyqt5-sip-12.15:=[${PYTHON_USEDEP}] " BDEPEND=" >=dev-python/pyqt-builder-1.14.1[${PYTHON_USEDEP}] >=dev-python/sip-6.8.6[${PYTHON_USEDEP}] >=dev-qt/qtcore-5.15:5 dbus? ( virtual/pkgconfig ) " src_prepare() { default # PyQt-builder probes qmake's compiler outside ebuild arguments; expose only # available compilers to support -native-symlinks. mkdir "${T}"/cxx || die local cxx ! cxx=$(type -P "${CHOST}"-g++) || ln -s -- "${cxx}" "${T}"/cxx/g++ || die ! cxx=$(type -P "${CHOST}"-clang++) || ln -s -- "${cxx}" "${T}"/cxx/clang++ || die PATH=${T}/cxx:${PATH} } python_configure_all() { append-cxxflags ${CPPFLAGS} # DISTUTILS_EXT must respect CPPFLAGS. pyqt_use_enable() { local state=$(usex ${1} --enable= --disable=) shift echo ${*/#/${state}} } DISTUTILS_ARGS=( --jobs="$(makeopts_jobs)" --qmake="$(qt5_get_bindir)"/qmake --qmake-setting="$(qt5_get_qmake_args)" --verbose --confirm-license --enable=pylupdate --enable=pyrcc --enable=Qt --enable=QtCore $(pyqt_use_enable dbus QtDBus) $(pyqt_use_enable declarative QtQml QtQuick \ $(usev widgets QtQuickWidgets)) $(pyqt_use_enable gui QtGui \ $(use gles2-only && echo _QOpenGLFunctions_ES2 || echo _QOpenGLFunctions_{2_0,2_1,4_1_Core})) $(pyqt_use_enable multimedia QtMultimedia \ $(usev widgets QtMultimediaWidgets)) $(pyqt_use_enable network QtNetwork) $(pyqt_use_enable opengl QtOpenGL) $(pyqt_use_enable printsupport QtPrintSupport) $(pyqt_use_enable sql QtSql) $(pyqt_use_enable svg QtSvg) $(pyqt_use_enable testlib QtTest) $(pyqt_use_enable widgets QtWidgets) $(pyqt_use_enable x11extras QtX11Extras) --enable=QtXml # Use PyQt6 for unsupported modules. --disable=QtBluetooth --disable=QtDesigner --disable=QtHelp --disable=QtLocation --disable=QtPositioning --disable=QtSensors --disable=QtSerialPort --disable=QtTextToSpeech --disable=QtWebChannel --disable=QtWebSockets --disable=QtXmlPatterns --no-designer-plugin $(usev debug '--debug --qml-debug --tracing') $(usev !dbus --no-dbus-python) # PEP 517 wheels intentionally omit the designer and QML plugins. $(usev !declarative --no-qml-plugin) $(usev gles2-only --disabled-feature=PyQt_Desktop_OpenGL) $(usev !ssl --disabled-feature=PyQt_SSL) ) } python_install_all() { einstalldocs use examples && dodoc -r examples }