File python3-qt5.spec of Package python3-qt5

#
# spec file for package python-qt4
#
# Copyright (c) 2012 SUSE LINUX Products 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.0
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
%define rversion %{version}
Url:            http://www.riverbankcomputing.com/software/pyqt/intro
Source0:        PyQt-gpl-%{rversion}.tar.gz
Patch1:         build-compare.diff
Patch2:         disable-rpaths.diff
Patch3:         mainloop_rename.diff
BuildRequires:  dbus-1-python3-devel
BuildRequires:  fdupes
BuildRequires:  pkg-config
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5Declarative)
BuildRequires:  pkgconfig(Qt5Quick)
BuildRequires:  pkgconfig(Qt5Svg)
BuildRequires:  pkgconfig(Qt5UiTools)
BuildRequires:  pkgconfig(Qt5X11Extras)
BuildRequires:  pkgconfig(Qt5WebKit)
BuildRequires:  pkgconfig(Qt5WebKitWidgets)
#BuildRequires:  phonon-devel
BuildRequires:  python3-devel

%if 0%{?suse_version} <= 1140
%{!?python3_sitearch: %global python3_sitearch %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%{!?py3_ver: %global py3_ver %(python3 -c "import sys; version=str(sys.version_info[0]) + '.' + str(sys.version_info[1]); print(version)" 2>/dev/null || echo PYTHON-NOT-FOUND)}
%else
BuildRequires:  python3-base
%endif
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:       libqt5-devel
Requires:       python-qt5-utils
Requires:       python-sip-devel

%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-%{rversion}
#PATCH-FIX-OPENSUSE: ease comparison of build by removing a ctime() call in 
# the files compiled by pyuic5
%patch1
#PATCH-FIX-OPENSUSE: Disable RPATH when building PyQt5.
%patch2
#PATCH-FIX-UPSTREAM: Fix the mainloop qt lib name to prevent conflicts with
# PyQt4.
%patch3 -p1

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

make %{?_smp_mflags}

%install
%make_install INSTALL_ROOT=%{buildroot}
# pylupdate4 and pyrcc4 are in python-qt5-utils
rm %{buildroot}%{_bindir}/pylupdate5 %{buildroot}%{_bindir}/pyrcc5
rm -rf %{buildroot}%{_datadir}/sip/PyQt5
mv %{buildroot}%{_bindir}/pyuic5 %{buildroot}%{_bindir}/py3uic5
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
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 contrib doc examples $DOCDIR
pushd $DOCDIR
chmod -x `find . -name '*.py*'`
popd
 # create hardlinks for duplicate files
%fdupes -s $DOCDIR

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc README
%{python3_sitearch}/PyQt5/

%files devel
%defattr(-,root,root)
%attr(755,root,root) %{_bindir}/py3uic5
%{_datadir}/qt5/qsci/
%{_docdir}/python-qt5-devel
%{_libdir}/qt5/plugins/designer/libpy3qt5.so

%changelog
openSUSE Build Service is sponsored by