File python-sip.spec of Package python-sip.1536
#
# spec file for package python-sip
#
# Copyright (c) 2015 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 rversion %{version}
%define python_sip_api 10.1
Name: python-sip
Version: 4.15.4
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: http://downloads.sourceforge.net/project/pyqt/sip/sip-%{rversion}/sip-%{rversion}.tar.gz
# PATCH-FIX-OPENSUSE disable-rpaths.diff -- Disable rpaths
Patch0: disable-rpaths.diff
# PATCH-FIX-OPENSUSE build-compare.diff cmorve69@yahoo.es -- Fix build-compare
Patch1: build-compare.diff
Patch2: 0001-Fixed_handling_of_nonpointer_object_variables_so_that.patch
Patch3: 0001-Fixed_a_regression_in_the_handling_of_static_non-pointer_object_variables.patch
Patch4: 0002-Fixed_a_missing_reference_in_the_previous_fix.patch
Patch5: 0001-Fixed_the_KeepReference_function_annotation_when.patch
Patch6: 0001-pyqt4_pyqt5_specific_data_structures.patch
Patch7: 0001-Implemented_the_PyQt5_signal_emitters.patch
Patch8: 0001-Fixed_a_code_generation_bug_for_variables_with_multi-const_types.patch
Patch9: 0002-Added_the_NoSetter_variable_annotation.patch
Patch10: 0001-Changed_handling_of_timelines_Added_-B_option.patch
Patch11: regenerate-files.diff
BuildRequires: c++_compiler
BuildRequires: python
BuildRequires: python-devel
Provides: python-sip(api) = %python_sip_api
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%py_requires
%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
Requires(post): update-alternatives
Provides: python-sip-bin = %{version}
Obsoletes: python-sip-bin < %{version}
%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.
%prep
%setup -q -n sip-%{rversion}
%patch0
%patch1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
# Link against libpython (fixes bnc#756282 and bnc#721280)
python configure.py --debug CFLAGS+="%{optflags}" CXXFLAGS+="%{optflags}" LIBS+="-lpython%{py_ver}"
make %{?_smp_mflags}
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
echo "%%requires_python_sip_api Requires: python-sip(api) = $sip_major.$sip_minor" > macros.%name
%install
make DESTDIR=%{buildroot} install
mkdir -p %{buildroot}%{_datadir}/sip
# For alternatives
mv %{buildroot}%{_bindir}/sip %{buildroot}%{_bindir}/sip-%{py_ver}
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
touch %{buildroot}%{_sysconfdir}/alternatives/sip
ln -s -f %{_sysconfdir}/alternatives/sip %{buildroot}/%{_bindir}/sip
install -m 644 -D macros.%name %{buildroot}/%{_sysconfdir}/rpm/macros.%name
# Point to the correct location for the documentation files
sed -i 's/"doc" directory/"doc" directory of package %{name}-devel/' README
%post devel
update-alternatives --install %{_bindir}/sip sip %{_bindir}/sip-%{py_ver} 50
%preun devel
if ["$1" = 0] ; then
update-alternatives --remove sip %{_bindir}/sip-%{py_ver}
fi
%files
%defattr(-,root,root,-)
%doc README
%{py_sitedir}/sip.so
%files devel
%defattr(-,root,root,-)
%doc NEWS LICENSE* doc/
%config %{_sysconfdir}/rpm/macros.%name
%{_bindir}/sip-%{py_ver}
%ghost %{_sysconfdir}/alternatives/sip
%{_bindir}/sip
%{py_incdir}/sip.h
%{py_sitedir}/sipconfig.py
%{py_sitedir}/sipdistutils.py
%{_datadir}/sip/
%changelog