File python3-qt5.spec of Package python-qt5

#
# spec file for package python3-qt5
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           python3-qt5
Version:        5.5.1
Release:        0
Summary:        PyQt - python bindings for Qt 5
License:        SUSE-GPL-2.0-with-FLOSS-exception or GPL-3.0 or SUSE-NonFree
Group:          Development/Libraries/Python
Url:            http://www.riverbankcomputing.com/software/pyqt/intro
Source:         http://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.5.1/PyQt-gpl-%{version}.tar.gz
Source99:       %{name}-rpmlintrc
# PATCH-FIX-OPENSUSE: DIsable RPATH
Patch1:         disable-rpaths.diff
# PATCH-FIX-UPSTREAM: fix_qreal_check.diff -- check if qreal is double based on sizeof
Patch2:         fix_qreal_check.diff
BuildRequires:  dbus-1-python-devel
BuildRequires:  dbus-1-python3-devel
BuildRequires:  libQt5WebKit5-devel
BuildRequires:  libQt5WebKitWidgets-devel
BuildRequires:  libqt5-qtbase-devel
BuildRequires:  libqt5-qtdeclarative-devel
BuildRequires:  libqt5-qtmultimedia-devel
BuildRequires:  libqt5-qtserialport-devel
BuildRequires:  libqt5-qtsvg-devel
BuildRequires:  libqt5-qttools-devel
BuildRequires:  libqt5-qtwebchannel-devel
%if 0%{?suse_version} >= 1320
%ifnarch ppc ppc64 ppc64le s390 s390x
BuildRequires:  libqt5-qtwebengine-devel
%endif
%endif
BuildRequires:  libqt5-qtconnectivity-devel
BuildRequires:  libqt5-qtwebsockets-devel
BuildRequires:  libqt5-qtx11extras-devel
BuildRequires:  libqt5-qtxmlpatterns-devel
BuildRequires:  pkg-config
#BuildRequires:  phonon-devel
BuildRequires:  python3-base
BuildRequires:  python3-devel
BuildRequires:  python3-sip-devel >= 4.16.9
Requires:       python(abi) = %{py3_ver}
%requires_python3_sip_api

%description
PyQt is a set of Python bindings for Trolltech's Qt application
framework and runs on all platforms supported by Qt including Windows,
MacOS/X and Linux. There are two sets of bindings: PyQt v5 supports Qt
v5, and it can be co-installed with PyQt4.

%package devel
Summary:        PyQt - devel part of python bindings for Qt 5
Group:          Development/Libraries/Python
Requires:       %{name} = %{version}
Requires:       libQt5WebKit5-devel
Requires:       libQt5WebKitWidgets-devel
Requires:       libqt5-qtbase-devel
Requires:       libqt5-qtdeclarative-devel
Requires:       libqt5-qtsvg-devel
Requires:       libqt5-qttools-devel
Requires:       libqt5-qtx11extras-devel
Requires:       python-qt5-utils
Requires:       python3-sip-devel >= 4.16.9
Requires:       update-alternatives

%description devel
PyQt is a set of Python bindings for Trolltech's Qt application
framework and runs on all platforms supported by Qt including Windows,
MacOS/X and Linux. There are two sets of bindings: PyQt v5 supports Qt
v5, and it can be co-installed with PyQt4.

This package contains all the developer tools you need to create your
own PyQt applications.

%prep
%setup -q -n PyQt-gpl-%{version}
#PATCH-FIX-OPENSUSE: Disable RPATH when building PyQt5.
%patch1
%patch2 -p1

%build
export CXXFLAGS="%{optflags}"
export CFLAGS="%{optflags}"
python3 configure.py --confirm-license --qsci-api -u --qmake %{_libqt5_qmake}

make %{?_smp_mflags}

%install
%make_install INSTALL_ROOT=%{buildroot}

# Alternatives to prevent conflicts

# pyuic5

mv %{buildroot}%{_bindir}/pyuic5 %{buildroot}%{_bindir}/pyuic5-%{py3_ver}
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
touch %{buildroot}%{_sysconfdir}/alternatives/pyuic5
ln -s -f %{_sysconfdir}/alternatives/pyuic5 %{buildroot}/%{_bindir}/pyuic5

#pylupdate5

mv %{buildroot}%{_bindir}/pylupdate5 %{buildroot}%{_bindir}/pylupdate5-%{py3_ver}
touch %{buildroot}%{_sysconfdir}/alternatives/pylupdate5
ln -s -f %{_sysconfdir}/alternatives/pylupdate5 %{buildroot}/%{_bindir}/pylupdate5

#pyrcc5

mv %{buildroot}%{_bindir}/pyrcc5 %{buildroot}%{_bindir}/pyrcc5-%{py3_ver}
touch %{buildroot}%{_sysconfdir}/alternatives/pyrcc5
ln -s -f %{_sysconfdir}/alternatives/pyrcc5 %{buildroot}/%{_bindir}/pyrcc5

rm -rf %{buildroot}%{_datadir}/sip/PyQt5

mv %{buildroot}%{_datadir}/qt5/qsci/api/python %{buildroot}%{_datadir}/qt5/qsci/api/python3
mv %{buildroot}%{_libqt5_plugindir}/designer/libpyqt5.so %{buildroot}%{_libqt5_plugindir}/designer/libpy3qt5.so
mv %{buildroot}%{_libqt5_plugindir}/PyQt5/libpyqt5qmlplugin.so %{buildroot}%{_libqt5_plugindir}/PyQt5/libpy3qt5qmlplugin.so

sed -i 's/The "doc" directory/The "doc" directory of package %{name}-devel/' README
DOCDIR=%{buildroot}%{_docdir}/%{name}-devel
mkdir -p $DOCDIR
cp -pr NEWS doc examples $DOCDIR
pushd $DOCDIR
chmod -x `find . -name '*.py*'`
popd

%post devel

#Python 3 is not yet default on oS, so we give lower priority to the tools

update-alternatives --install %{_bindir}/pyuic5 pyuic5 %{_bindir}/pyuic5-%{py3_ver} 40
update-alternatives --install %{_bindir}/pylupdate5 pylupdate5 %{_bindir}/pylupdate5-%{py3_ver} 40
update-alternatives --install %{_bindir}/pyrcc5 pyrcc5 %{_bindir}/pyrcc5-%{py3_ver} 40

%preun devel

if [ "$1" = 0 ] ; then
    update-alternatives --remove pyuic5 %{_bindir}/pyuic5-%{py3_ver}
    update-alternatives --remove pyrcc5 %{_bindir}/pyrcc5-%{py3_ver}
    update-alternatives --remove pylupdate5 %{_bindir}/pylupdate5-%{py3_ver}
fi

%files
%defattr(-,root,root)
%doc README
%{python3_sitelib}/dbus/mainloop/pyqt5.so
%{python3_sitearch}/PyQt5/
%dir %{_libqt5_plugindir}/PyQt5/
%{_libqt5_plugindir}/PyQt5/libpy3qt5qmlplugin.so

%files devel
%defattr(-,root,root)
%attr(755,root,root) %ghost %{_bindir}/pyuic5
%attr(755,root,root) %ghost %{_bindir}/pylupdate5
%attr(755,root,root) %ghost %{_bindir}/pyrcc5
%{_datadir}/qt5/qsci/
%{_docdir}/python3-qt5-devel
%{_libdir}/qt5/plugins/designer/libpy3qt5.so
%ghost  %{_sysconfdir}/alternatives/pyuic5
%ghost  %{_sysconfdir}/alternatives/pylupdate5
%ghost  %{_sysconfdir}/alternatives/pyrcc5
%attr(755,root,root) %{_bindir}/pyuic5-%{py3_ver}
%attr(755,root,root) %{_bindir}/pylupdate5-%{py3_ver}
%attr(755,root,root) %{_bindir}/pyrcc5-%{py3_ver}

%changelog
openSUSE Build Service is sponsored by