python-sip/python-sip.spec
Luca Beltrame 4f6635d344 Accepting request 489477 from KDE:Qt
Since qt5 is the main Qt platform, KDE:Qt5 should be the devel package for python-sip and KDE:Qt should link to the KDE:Qt5 version.

OBS-URL: https://build.opensuse.org/request/show/489477
OBS-URL: https://build.opensuse.org/package/show/KDE:Qt5/python-sip?expand=0&rev=1
2017-04-20 05:05:38 +00:00

196 lines
6.2 KiB
RPMSpec

#
# spec file for package python-sip
#
# 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 python_sip_api 12.1
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-sip
Version: 4.19.1
Release: 0
Summary: SIP tool to use python sip bindings
License: GPL-2.0 or GPL-3.0 or SUSE-SIP
Group: Development/Libraries/Python
Url: http://www.riverbankcomputing.com/software/sip/introa
Source0: sip-%{version}.tar.gz
# PATCH-FIX-OPENSUSE disable-rpaths.diff -- Disable rpaths
Patch0: disable-rpaths.diff
BuildRequires: %{python_module devel}
BuildRequires: c++_compiler
BuildRequires: python-rpm-macros
Requires: %{name}-common = %{version}
Provides: python-sip(api) = %{python_sip_api}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%python_subpackages
%description
SIP is a tool that makes it very easy to create Python bindings for C
and C++ libraries. It was originally developed to create PyQt, the
Python bindings for the Qt toolkit, but can be used to create bindings
for any C or C++ library.
%package devel
Summary: SIP tool to create python bindings
Group: Development/Libraries/Python
Requires: %{name} = %{version}
Requires: c++_compiler
Requires: python-devel
Provides: %{name}-bin = %{version}
Obsoletes: %{name}-bin < %{version}
Requires(post): update-alternatives
Requires(postun): update-alternatives
%description devel
SIP is a tool that makes it very easy to create Python bindings for C
and C++ libraries. It was originally developed to create PyQt, the
Python bindings for the Qt toolkit, but can be used to create bindings
for any C or C++ library.
This package contains all the developer tools you need to create your
own sip bindings.
%package -n %{name}-doc
Summary: SIP tool to create python bindings -- common documentation
Group: Development/Libraries/Python
Provides: %{python_module sip-doc = %{version}}
%description -n %{name}-doc
SIP is a tool that makes it very easy to create Python bindings for C
and C++ libraries. It was originally developed to create PyQt, the
Python bindings for the Qt toolkit, but can be used to create bindings
for any C or C++ library.
This package contains common documentation files shared between python2
and python3 versions of sip.
%package -n %{name}-common
Summary: SIP tool to create python bindings -- common files
Group: Development/Libraries/Python
Provides: %{python_module sip-common = %{version}}
%description -n %{name}-common
SIP is a tool that makes it very easy to create Python bindings for C
and C++ libraries. It was originally developed to create PyQt, the
Python bindings for the Qt toolkit, but can be used to create bindings
for any C or C++ library.
This package contains common files shared between python2 and python3
versions of sip.
%prep
%setup -q -n sip-%{version}
%patch0 -p1
sip_major=$(grep "define SIP_API_MAJOR_NR" siplib/sip.h.in | awk '{print $3}')
sip_minor=$(grep "define SIP_API_MINOR_NR" siplib/sip.h.in | awk '{print $3}')
if test "%{python_sip_api}" != "$sip_major.$sip_minor"; then
echo "API version was changed to $sip_major.$sip_minor"
exit 1
fi
%build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
%{python_expand mkdir build_%{$python_bin_suffix}
pushd build_%{$python_bin_suffix}
# Link against libpython (fixes bnc#756282 and bnc#721280)
ldlibrary=`$python -c "import sysconfig as s;print(s.get_config_var('LDLIBRARY')[3:-3])"`
$python ../configure.py --debug CFLAGS+="%{optflags}" CXXFLAGS+="%{optflags}" LIBS+="-l$ldlibrary"
make %{?_smp_mflags}
# Point to the correct location for the documentation files
cp ../README ./
sed -i 's/"doc" directory/"doc" directory of package %{$python_prefix}-sip-devel/' README
popd
}
%install
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
%{python_expand pushd build_%{$python_bin_suffix}
%make_install
popd
# Prepare for update-alternatives usage
mv %{buildroot}%{_bindir}/sip %{buildroot}%{_bindir}/sip-%{$python_bin_suffix}
}
mkdir -p %{buildroot}/%{_sysconfdir}/rpm/
%if 0%{have_python2}
echo "%%requires_python2_sip_api Requires: %{python2_prefix}-sip(api) = %{python_sip_api}" > %{buildroot}/%{_sysconfdir}/rpm/macros.%{python2_prefix}-sip
echo "%%requires_python_sip_api Requires: %{python2_prefix}-sip(api) = %{python_sip_api}" >> %{buildroot}/%{_sysconfdir}/rpm/macros.%{python2_prefix}-sip
%py_compile %{buildroot}%{python2_sitearch}
%endif
%if 0%{have_python3}
echo "%%requires_python3_sip_api Requires: %{python3_prefix}-sip(api) = %{python_sip_api}" > %{buildroot}/%{_sysconfdir}/rpm/macros.%{python3_prefix}-sip
%py3_compile %{buildroot}%{python3_sitearch}
%endif
%prepare_alternative sip
mkdir -p %{buildroot}%{_datadir}/sip
%post devel
%{python_install_alternative sip}
%postun devel
%python_uninstall_alternative sip
%files %{python_files}
%defattr(-,root,root,-)
%doc ChangeLog LICENSE* NEWS
%doc build_%{python_bin_suffix}/README
%{python_sitearch}/sip.so
%files %{python_files devel}
%defattr(-,root,root,-)
%doc LICENSE*
%config %{_sysconfdir}/rpm/macros.%{python_prefix}-sip
%python_alternative %{_bindir}/sip
%{_includedir}/python%{python_version}*/sip.h
%{python_sitearch}/sipconfig.py*
%{python_sitearch}/sipdistutils.py*
%{python_sitearch}/sip.pyi
%pycache_only %{python_sitearch}/__pycache__/sipconfig.*.py*
%pycache_only %{python_sitearch}/__pycache__/sipdistutils.*.py*
%files -n python-sip-doc
%defattr(-,root,root,-)
%doc LICENSE*
%doc doc/
%files -n python-sip-common
%defattr(-,root,root,-)
%doc LICENSE*
%{_datadir}/sip/
%changelog