%global __python3 /usr/bin/python3.11 %global python3_pkgversion 3.11 %global _python_bytecompile_extra 1 %if 0%{?fedora} || 0%{?rhel} > 7 %{echo:anyi1} %global with_python3 1 %global python3_dbus_dir %(%{__python3} -c "import dbus.mainloop; print(dbus.mainloop.__path__[0])" 2>/dev/null || echo "%{python3_sitearch}/dbus/mainloop") %endif # enable/disable individual modules # drop power64, it's not supported yet (than) %if 0%{?fedora} %ifarch %{?qt5_qtwebengine_arches}%{?!qt5_qtwebengine_arches:%{ix86} x86_64 %{arm} aarch64 mips mipsel mips64el} %{echo:anyi2} %global webengine 1 %endif %endif %if 0%{?fedora} %{echo:anyi3} %global webkit 1 %endif %global rpm_macros_dir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) ## f29+ no longer using separate sipdir for python3 %global py3_sipdir %{_datadir}/sip/PyQt5 %global sip_ver 4.19.23 # see also https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/JQQ66XJSIT2FGTK2YQY7AXMEH5IXMPUX/ %undefine _strict_symbol_defs_build Summary: PyQt5 is Python bindings for Qt5 Name: python-qt5 Version: 5.15.0 Release: 3%{?dist} License: GPLv3 Url: http://www.riverbankcomputing.com/software/pyqt/ Source0: https://files.pythonhosted.org/packages/8c/90/82c62bbbadcca98e8c6fa84f1a638de1ed1c89e85368241e9cc43fcbc320/PyQt5-%{version}.tar.gz Source1: macros.pyqt5 # wrapper, see https://bugzilla.redhat.com/show_bug.cgi?id=1193107#c9 Source2: pylupdate5.sh Source3: pyrcc5.sh Source4: pyuic5.sh ## upstream patches ## upstreamable patches Patch0: python-qt5_sipdir.patch # support newer Qt5 releases Patch1: PyQt5-Timeline.patch BuildRequires: chrpath BuildRequires: findutils BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(dbus-python) BuildRequires: qt5-qtbase-private-devel BuildRequires: pkgconfig(Qt5Core) >= 5.5 BuildRequires: pkgconfig(Qt5Bluetooth) BuildRequires: pkgconfig(Qt5DBus) BuildRequires: pkgconfig(Qt5Designer) BuildRequires: pkgconfig(Qt5Gui) BuildRequires: pkgconfig(Qt5Location) BuildRequires: pkgconfig(Qt5Multimedia) pkgconfig(libpulse-mainloop-glib) BuildRequires: pkgconfig(Qt5Nfc) BuildRequires: pkgconfig(Qt5Network) pkgconfig(Qt5OpenGL) BuildRequires: pkgconfig(Qt5Positioning) BuildRequires: pkgconfig(Qt5Quick) pkgconfig(Qt5QuickWidgets) #BuildRequires: pkgconfig(Qt5Script) BuildRequires: pkgconfig(Qt5Sensors) BuildRequires: pkgconfig(Qt5SerialPort) BuildRequires: pkgconfig(Qt5Sql) pkgconfig(Qt5Svg) pkgconfig(Qt5Test) BuildRequires: pkgconfig(Qt5X11Extras) BuildRequires: pkgconfig(Qt5Xml) pkgconfig(Qt5XmlPatterns) BuildRequires: pkgconfig(Qt5WebChannel) BuildRequires: pkgconfig(Qt5WebSockets) %if 0%{?with_python3} BuildRequires: python%{python3_pkgversion}-devel python%{python3_pkgversion} BuildRequires: python%{python3_pkgversion}-dbus BuildRequires: python%{python3_pkgversion}-pyqt5-sip >= %{sip_ver} BuildRequires: python%{python3_pkgversion}-sip-devel >= %{sip_ver} BuildRequires: python%{python3_pkgversion}-setuptools %endif # with_python3 # when split out %if 0%{?webengine} || 0%{?webkit} %{echo:anyi4} Obsoletes: python-qt5 < 5.5.1-10 %endif %description %{summary}. %global __provides_exclude_from ^(%{_qt5_plugindir}/.*\\.so)$ %package rpm-macros Summary: RPM macros %{name} # when split out Conflicts: python-qt5 < 5.6 Conflicts: python3-qt5 < 5.6 BuildArch: noarch %description rpm-macros %{summary}. %package -n python%{python3_pkgversion}-qt5 Summary: Python 3 bindings for Qt5 # when split out %if 0%{?webengine} || 0%{?webkit} %{echo:anyi5} Obsoletes: python3-qt5 < 5.5.1-10 %endif Provides: PyQt5 = %{version}-%{release} Provides: PyQt5%{?_isa} = %{version}-%{release} Provides: python%{python3_pkgversion}-PyQt5 = %{version}-%{release} Provides: python%{python3_pkgversion}-PyQt5%{?_isa} = %{version}-%{release} Requires: python%{python3_pkgversion}-qt5-base%{?_isa} = %{version}-%{release} %{?python_provide:%python_provide python%{python3_pkgversion}-qt5} %description -n python%{python3_pkgversion}-qt5 %{summary}. %package -n python%{python3_pkgversion}-qt5-base Summary: Python 3 bindings for Qt5 base %{?_qt5:Requires: %{_qt5}%{?_isa} = %{_qt5_version}} %if 0%{?_python3_sip_api_major} %{echo:anyi6} %{?_python3_sip_api:Requires: python%{python3_pkgversion}-pyqt5-sip-api(%{_python3_sip_api_major}) >= %{_python3_sip_api}} %else %{echo:anyi7} %{?_sip_api:Requires: python%{python3_pkgversion}-pyqt5-sip-api(%{_sip_api_major}) >= %{_sip_api}} %endif Provides: python%{python3_pkgversion}-PyQt5-base = %{version}-%{release} Provides: python%{python3_pkgversion}-PyQt5-base%{?_isa} = %{version}-%{release} Requires: %{name}-rpm-macros = %{version}-%{release} Requires: python%{python3_pkgversion}-dbus %{?python_provide:%python_provide python%{python3_pkgversion}-qt5-base} %description -n python%{python3_pkgversion}-qt5-base %{summary}. %package -n python%{python3_pkgversion}-qt5-devel Summary: Development files for python3-qt5 Requires: python%{python3_pkgversion}-qt5%{?_isa} = %{version}-%{release} Requires: qt5-qtbase-devel Requires: python%{python3_pkgversion}-sip-devel Provides: python%{python3_pkgversion}-PyQt5-devel = %{version}-%{release} %{?python_provide:%python_provide python%{python3_pkgversion}-qt5-devel} %description -n python%{python3_pkgversion}-qt5-devel Files needed to build other bindings for C++ classes that inherit from any of the Qt5 classes %package doc Summary: Developer documentation for %{name} Provides: PyQt5-doc = %{version}-%{release} BuildArch: noarch %description doc %{summary}. %if 0%{?webengine} %{echo:anyi8} %package -n python%{python3_pkgversion}-qt5-webengine Summary: Python3 bindings for Qt5 WebEngine BuildRequires: pkgconfig(Qt5WebEngine) Obsoletes: python3-webengine < 5.5.1-13 Obsoletes: python3-qt5 < 5.5.1-10 Requires: python%{python3_pkgversion}-qt5%{?_isa} = %{version}-%{release} %{?python_provide:%python_provide python%{python3_pkgversion}-qt5-webengine} %description -n python%{python3_pkgversion}-qt5-webengine %{summary}. %endif %if 0%{?webkit} %{echo:anyi9} %package -n python%{python3_pkgversion}-qt5-webkit Summary: Python3 bindings for Qt5 Webkit BuildRequires: pkgconfig(Qt5WebKit) BuildRequires: pkgconfig(Qt5WebKitWidgets) Obsoletes: python3-qt5 < 5.5.1-10 Requires: python%{python3_pkgversion}-qt5%{?_isa} = %{version}-%{release} %{?python_provide:%python_provide python%{python3_pkgversion}-qt5-webkit} %description -n python%{python3_pkgversion}-qt5-webkit %{summary}. %endif %prep %setup -q -n PyQt5-%{version} %patch0 -p1 %patch1 -p1 %build ## see also https://www.riverbankcomputing.com/static/Docs/PyQt5/installation.html PATH=%{_qt5_bindir}:$PATH ; export PATH # Python 3 build: %if 0%{?with_python3} %{echo:anyipython3} mkdir %{_target_platform}-python3 cp -a * %{_target_platform}-python3/ ||: pushd %{_target_platform}-python3 %{__python3} ./configure.py \ --assume-shared \ --confirm-license \ --qmake=%{_qt5_qmake} \ %{?with_python2:--no-qsci-api}%{!?with_python2:--qsci-api --qsci-api-destdir=%{_qt5_datadir}/qsci} \ %{?py3_sip:--sip=%{_bindir}/python3-sip} \ %{?py3_sipdir:--sipdir=%{py3_sipdir}} \ --verbose \ --dbus=%{_includedir}/dbus-1.0/ \ QMAKE_CFLAGS_RELEASE="%{optflags}" \ QMAKE_CXXFLAGS_RELEASE="%{optflags} `pkg-config --cflags dbus-python`" \ QMAKE_LFLAGS_RELEASE="%{?__global_ldflags}" %make_build popd %endif # with_python3 %install # Python 3 build: %if 0%{?with_python3} %{echo:anyipython31} %make_install INSTALL_ROOT=%{buildroot} -C %{_target_platform}-python3 if [ "%{_prefix}" != "/usr" ]; then cp -ru %{buildroot}/usr/* %{buildroot}%{_prefix}/ rm -rf %{buildroot}/usr/* fi %if "%py3_sipdir" == "%{_datadir}/sip/PyQt5" %{echo:anyipython32} # copy files to old location for compat purposes temporarily mkdir -p %{buildroot}%{_datadir}/python3-sip cp -alf %{buildroot}%{py3_sipdir} \ %{buildroot}%{_datadir}/python3-sip/PyQt5 %endif if [ "%{_prefix}" != "/usr" ]; then cp -ru %{buildroot}/usr/* %{buildroot}%{_prefix}/ || echo "Nothing to copy" rm -rf %{buildroot}/usr/* fi # ensure .so modules are executable for proper -debuginfo extraction find %{buildroot} -type f -name '*.so' | xargs chmod a+rx #for i in %%{buildroot}%%{python3_sitearch}/PyQt5/*.so %%{buildroot}%%{python3_dbus_dir}/pyqt5.so ; do #test -x $i || chmod a+rx $i #done %endif # with_python3 # remove Python3 code from Python2 directory, fixes FTBFS like PyQt4 (#564633) rm -rfv %{buildroot}%{python2_sitearch}/PyQt5/uic/port_v3/ # remove Python2 code from Python3 directory (for when/if we support python3 here) rm -rfv %{buildroot}%{python3_sitearch}/PyQt5/uic/port_v2/ # rpm macros install -p -m644 -D %{SOURCE1} \ %{buildroot}%{rpm_macros_dir}/macros.pyqt5 sed -i \ -e "s|@@NAME@@|%{name}|g" \ -e "s|@@EPOCH@@|%{?epoch}%{!?epoch:0}|g" \ -e "s|@@VERSION@@|%{version}|g" \ -e "s|@@EVR@@|%{?epoch:%{epoch:}}%{version}-%{release}|g" \ %{buildroot}%{rpm_macros_dir}/macros.pyqt5 %if 0%{?with_python3} %{echo:anyipython322} # install wrappers to handle both/either python2/python3 # TODO: consider alternatives? -- rex rm -fv %{buildroot}%{_bindir}/{pyrcc5,pylupdate5,pyuic5} install -p -m755 -D %{SOURCE2} %{buildroot}%{_bindir}/pylupdate5 install -p -m755 -D %{SOURCE3} %{buildroot}%{_bindir}/pyrcc5 install -p -m755 -D %{SOURCE4} %{buildroot}%{_bindir}/pyuic5 sed -i \ -e "s|@PYTHON3@|%{__python3}|g" \ -e "s|@PYTHON2@|%{__python2}|g" \ %{buildroot}%{_bindir}/{pyrcc5,pylupdate5,pyuic5} %endif %py_byte_compile %{__python3} %{buildroot}%{python3_sitearch} %files rpm-macros %{rpm_macros_dir}/macros.pyqt5 %if 0%{?with_python3} %{echo:anyipython33} %files -n python%{python3_pkgversion}-qt5 %{python3_sitearch}/PyQt5/QtBluetooth.* %{python3_sitearch}/PyQt5/QtDesigner.* %{python3_sitearch}/PyQt5/QtHelp.* %{python3_sitearch}/PyQt5/QtLocation.* %{python3_sitearch}/PyQt5/QtMultimedia.* %{python3_sitearch}/PyQt5/QtMultimediaWidgets.* %{python3_sitearch}/PyQt5/QtNfc.* %{python3_sitearch}/PyQt5/QtPositioning.* %{python3_sitearch}/PyQt5/QtQml.* %{python3_sitearch}/PyQt5/QtQuick.* %{python3_sitearch}/PyQt5/QtQuickWidgets.* %{python3_sitearch}/PyQt5/QtSensors.* %{python3_sitearch}/PyQt5/QtSerialPort.* %{python3_sitearch}/PyQt5/QtSvg.* %{python3_sitearch}/PyQt5/QtWebChannel.* %{python3_sitearch}/PyQt5/QtWebSockets.* %{python3_sitearch}/PyQt5/QtX11Extras.* %{python3_sitearch}/PyQt5/QtXmlPatterns.* %files -n python%{python3_pkgversion}-qt5-base %doc NEWS README %license LICENSE %{python3_dbus_dir}/pyqt5.so %dir %{python3_sitearch}/PyQt5/ %{python3_sitearch}/PyQt5-%{version}.dist-info %{python3_sitearch}/PyQt5/__pycache__/__init__.* %{python3_sitearch}/PyQt5/__init__.py* %{python3_sitearch}/PyQt5/Qt.* %{python3_sitearch}/PyQt5/QtCore.* %{python3_sitearch}/PyQt5/QtDBus.* %{python3_sitearch}/PyQt5/QtGui.* %{python3_sitearch}/PyQt5/QtNetwork.* %{python3_sitearch}/PyQt5/QtOpenGL.* %{python3_sitearch}/PyQt5/QtPrintSupport.* %{python3_sitearch}/PyQt5/QtSql.* %{python3_sitearch}/PyQt5/QtTest.* %{python3_sitearch}/PyQt5/QtWidgets.* %{python3_sitearch}/PyQt5/QtXml.* %{python3_sitearch}/PyQt5/_QOpenGLFunctions_2_0.* %{python3_sitearch}/PyQt5/_QOpenGLFunctions_2_1.* %{python3_sitearch}/PyQt5/_QOpenGLFunctions_4_1_Core.* # plugins %{_qt5_plugindir}/PyQt5/ %{_qt5_plugindir}/designer/libpyqt5.so %{python3_sitearch}/PyQt5/uic/ # *was* in python3-qt5-devel %{_bindir}/pylupdate5 %{_bindir}/pyrcc5 %{_bindir}/pyuic5 %{python3_sitearch}/PyQt5/pylupdate.so %{python3_sitearch}/PyQt5/pylupdate_main.py* %{python3_sitearch}/PyQt5/__pycache__/pylupdate_main* %{python3_sitearch}/PyQt5/pyrcc.so %{python3_sitearch}/PyQt5/pyrcc_main.py* %{python3_sitearch}/PyQt5/__pycache__/pyrcc_main* %if 0%{?webengine} %{echo:anyi332} %files -n python%{python3_pkgversion}-qt5-webengine %{python3_sitearch}/PyQt5/QtWebEngine.* %{python3_sitearch}/PyQt5/QtWebEngineCore.* %{python3_sitearch}/PyQt5/QtWebEngineWidgets.* %endif %if 0%{?webkit} %{echo:anyi34} %files -n python%{python3_pkgversion}-qt5-webkit %{python3_sitearch}/PyQt5/QtWebKit.* %{python3_sitearch}/PyQt5/QtWebKitWidgets.* %endif %files -n python%{python3_pkgversion}-qt5-devel %{py3_sipdir}/ # compat location %dir %{_datadir}/python3-sip/ %{_datadir}/python3-sip/PyQt5/ %endif # with_python3 %files doc #doc doc/* %doc examples/ # avoid dep on qscintilla-python, own %%_qt5_datadir/qsci/... here for now %dir %{_qt5_datadir}/qsci/ %dir %{_qt5_datadir}/qsci/api/ %dir %{_qt5_datadir}/qsci/api/python/ %doc %{_qt5_datadir}/qsci/api/python/PyQt5.api %changelog