diff --git a/macros.pyqt b/macros.pyqt index 7d6c423..4c01cb1 100644 --- a/macros.pyqt +++ b/macros.pyqt @@ -1,9 +1,17 @@ +# Documentation: https://en.opensuse.org/openSUSE:Packaging_PyQt_and_SIP + %sip4_only() %{?use_sip4:%{**}} %sip5_only() %{?!use_sip4:%{**}} %pyqt5_sipdir %{?use_sip4:%_datadir/sip/PyQt5-%python_bin_suffix}%{?!use_sip4:%python_sitearch/PyQt5/bindings} +%pyqt6_sipdir %{python_sitearch}/PyQt6/bindings + +%_pyqt_datadir %{?pyqt_build_for_qt6:%{_qt6_datadir}}%{!?pyqt_build_for_qt6:%{_libqt5_datadir}} + +%_pyqt_qmake %{?pyqt_build_for_qt6:%{__qt6_qmake}}%{!?pyqt_build_for_qt6:%{_libqt5_qmake}} + %pyqt_build(c:m:s:v) \ export CXXFLAGS="%{optflags}" \ export CFLAGS="%{optflags}" \ @@ -24,9 +32,9 @@ export CFLAGS="%{optflags}" \ %else \ sip-build-%{$python_bin_suffix} \\\ --verbose \\\ - --api-dir %{_libqt5_datadir}/qsci/api/python_%{$python_bin_suffix}/ \\\ + --api-dir %{_pyqt_datadir}/qsci/api/python_%{$python_bin_suffix}/ \\\ --no-make \\\ - --qmake=%{_libqt5_qmake} \\\ + --qmake=%{_pyqt_qmake} \\\ --qmake-setting "QMAKE_CFLAGS += ${CFLAGS} ${CPPFLAGS}" \\\ --qmake-setting "QMAKE_CXXFLAGS += ${CXXFLAGS} ${CPPFLAGS}" \\\ %{-s*} \ @@ -41,6 +49,7 @@ popd \ %{python_expand pushd build \ %make_install INSTALL_ROOT=%{buildroot} \ popd \ +# move some files when installing PyQt5 packages built with SIP v4\ %if 0%{?use_sip4} \ [ -d %{buildroot}%{_libqt5_datadir}/qsci/api/python ] \\\ && mv -T %{buildroot}%{_libqt5_datadir}/qsci/api/python \\\ @@ -48,8 +57,12 @@ popd \ [ -d %{buildroot}/%{_datadir}/sip/PyQt5 ] \\\ && mv -T %{buildroot}/%{_datadir}/sip/PyQt5 %{buildroot}/%{_datadir}/sip/PyQt5-%{$python_bin_suffix} \ %endif \ +# rename PyQt5 plugins, if any \ find %{buildroot}%{_libqt5_plugindir} -name '*pyqt5*.so' \\\ | while read f; do mv ${f} ${f/pyqt5/py%{$python_bin_suffix}qt5}; done \ +# rename PyQt6 plugins, if any \ +find %{buildroot}%{_qt6_pluginsdir} -name '*pyqt6*.so' \\\ + | while read f; do mv ${f} ${f/pyqt6/py%{$python_bin_suffix}qt6}; done \ } \ %{nil} @@ -58,9 +71,7 @@ find %{buildroot}%{_libqt5_plugindir} -name '*pyqt5*.so' \\\ exdir=%{buildroot}%{_docdir}/%{$python_prefix}-%{1} \ mkdir -p $exdir \ cp -r examples $exdir/ \ -# Fix shebang. Depending on version of python-rpm-macros, expanded python could be basename or full path. \ -python_exec=$(which $python) \ -find $exdir -name "*.py" -exec sed -i "1 s|^#!%{_bindir}/env python.*$|#!${python_exec}|" {} \\; \ +find $exdir -name "*.py" -exec sed -i "1 s|^#!%{_bindir}/env python.*$|#!%{_bindir}/$python|" {} \\; \ %fdupes $exdir \ } \ %{nil} diff --git a/python-pyqt-rpm-macros.changes b/python-pyqt-rpm-macros.changes index fa521e7..42dee47 100644 --- a/python-pyqt-rpm-macros.changes +++ b/python-pyqt-rpm-macros.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Fri Feb 19 23:54:52 UTC 2021 - Ben Greiner + +- update to version 0.1 +- Add PyQt6 support +- Add link to wiki in macros file +- Remove python-rpm-macros interpreter workaround. The + inconsistency never made it into a released package. + ------------------------------------------------------------------- Wed Dec 2 16:55:14 UTC 2020 - Benjamin Greiner diff --git a/python-pyqt-rpm-macros.spec b/python-pyqt-rpm-macros.spec index 65b018e..59b1bb3 100644 --- a/python-pyqt-rpm-macros.spec +++ b/python-pyqt-rpm-macros.spec @@ -1,7 +1,7 @@ # # spec file for package python-pyqt-rpm-macros # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,11 +17,11 @@ Name: python-pyqt-rpm-macros -Version: 0.0.3 +Version: 0.1 Release: 0 Summary: RPM macros for building PyQt packages License: WTFPL -URL: https://en.opensuse.org/openSUSE:Packaging_PyQt5_and_SIP +URL: https://en.opensuse.org/openSUSE:Packaging_PyQt_and_SIP Source0: macros.pyqt Source1: LICENSE Requires: fdupes @@ -31,7 +31,7 @@ Requires: (python-sip-devel or python3-sip-devel) BuildArch: noarch %description -This package provides some macros for using SIP4 or SIP5 to build PyQt5 packages +This package provides some macros for using SIP v[456] to build PyQt[56] packages %prep cp %{SOURCE1} .