File python-pyside-shiboken.spec of Package python-pyside-shiboken
#
# spec file for package python-pyside-shiboken
#
# Copyright (c) 2017 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/
#
%define tarname shiboken
Name: python-pyside-%{tarname}
Version: 1.2.4
Release: 0
%define majorver %(echo "%{version}" | sed 's/\\.[0-9]*$//')
%define libsoname %(echo "%{majorver}" | sed 's/\\./_/')
%define libprefix lib%{tarname}
%define py_ver_mod %(python -c "import sys; sys.stdout.write(sys.version[:3].replace('.','_'))")
%define libpyname %{libprefix}-python%{py_ver}
%define libname %{libprefix}-python%{py_ver_mod}-%{libsoname}
%define pyname Shiboken
Summary: Generate CPython bindings from C++ code
License: GPL-2.0
Group: Development/Libraries/C and C++
Url: http://qt-project.org/wiki/PySide
Source0: https://github.com/PySide/Shiboken/archive/%{version}/%{tarname}-%{version}.tar.gz
BuildRequires: cmake
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: libqt4-devel
BuildRequires: libxml2-devel
BuildRequires: libxslt-devel
BuildRequires: python-Sphinx
BuildRequires: python-devel
Obsoletes: libapiextractor < %{version}
Provides: libapiextractor = %{version}
Obsoletes: libapiextractor-doc < %{version}
Provides: libapiextractor-doc = %{version}
Obsoletes: libgenrunner < %{version}
Provides: libgenrunner = %{version}
Requires: %{libname} = %{version}
Requires(post): update-alternatives
Requires(postun): update-alternatives
%description
Shiboken generates C++ code for CPython extensions. It is similar to
BoostPythonGenerator from boost::python, but is designed to create smaller
code.
%package -n %{libname}
Summary: Generate CPython bindings from C++ code
License: LGPL-2.1
Group: Development/Libraries/C and C++
%description -n %{libname}
Shiboken generates C++ code for CPython extensions. It is similar to
BoostPythonGenerator from boost::python, but is designed to create smaller
code.
%package doc
Summary: Documentation for %{name}
License: GPL-2.0
Group: Documentation/HTML
Recommends: %{libname} = %{version}
BuildArch: noarch
%description doc
Documentation and manuals for %{name}
%package -n %{libprefix}-devel
Summary: Development files for %{name}
License: LGPL-2.1
Group: Development/Libraries/C and C++
Requires: %{libname} = %{version}
# As cmake config files are not python version agnostic, python2 and 3 versions of developement
# package can't be installed at the same time
Conflicts: lib%{tarname}-python3-devel
Requires: cmake
Requires: libqt4-devel
Requires: libxml2-devel
Requires: libxslt-devel
Requires: python-devel
%description -n %{libprefix}-devel
Development libraries and headers needed to build software using %{name}
%prep
%setup -q -n Shiboken-%{version}
%build
%cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_TESTS=False
make %{?_smp_mflags}
make doc
%install
cd build
%makeinstall DESTDIR=%{buildroot}
mv %{buildroot}%{_bindir}/%{tarname} %{buildroot}%{_bindir}/%{tarname}-%{py_ver}
mv %{buildroot}%{_mandir}/man1/%{tarname}.1 %{buildroot}%{_mandir}/man1/%{tarname}-%{py_ver}.1
%fdupes %{buildroot}
# openSUSE 13.1 and lower have a bad bug with brp-symlink
%if 0%{?suse_version} >= 1315
ln -s %{_sysconfdir}/alternatives/%{tarname} %{buildroot}%{_bindir}/%{tarname}
ln -s %{_sysconfdir}/alternatives/%{tarname}.1 %{buildroot}%{_mandir}/man1/%{tarname}.1
ln -s %{_sysconfdir}/alternatives/%{tarname}.1.gz %{buildroot}%{_mandir}/man1/%{tarname}.1.gz
%endif
%pre
[ -h %{_bindir}/%{tarname} ] || rm -f %{_bindir}/%{tarname}
[ -h %{_mandir}/man1/%{tarname}.1.gz ] || rm -f %{_mandir}/man1/%{tarname}.1.gz
%post
/sbin/ldconfig
update-alternatives --install %{_bindir}/%{tarname} %{tarname} %{_bindir}/%{tarname}-%{py_ver} 20 \
--slave %{_mandir}/man1/%{tarname}.1.gz %{tarname}.1 %{_mandir}/man1/%{tarname}-%{py_ver}.1.gz
%preun
if [ $1 -eq 0 ] ; then
update-alternatives --remove %{tarname} %{_bindir}/%{tarname}-%{py_ver}
fi
%postun -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%post -n %{libname} -p /sbin/ldconfig
%files
%defattr(-,root,root)
%doc COPYING AUTHORS
%ghost %{_sysconfdir}/alternatives/%{tarname}
%ghost %{_sysconfdir}/alternatives/%{tarname}.1
%ghost %{_sysconfdir}/alternatives/%{tarname}.1.gz
%{_bindir}/%{tarname}*
%{_mandir}/man1/%{tarname}*.1.gz
%{python_sitearch}/%{tarname}.so
%files -n %{libname}
%defattr(-,root,root)
%doc COPYING.%{libprefix} AUTHORS
%{_libdir}/%{libpyname}.so.*
%files doc
%defattr(-,root,root)
%doc COPYING
%doc build/doc/html/*
%files -n %{libprefix}-devel
%defattr(-,root,root)
%{_includedir}/%{tarname}/
%{_libdir}/%{libpyname}.so
%{_libdir}/cmake/%{pyname}-%{version}/
%{_libdir}/pkgconfig/%{tarname}.pc
%changelog