Accepting request 478607 from devel:languages:python:singlespec

python-sip ported to the new single-spec python system

OBS-URL: https://build.opensuse.org/request/show/478607
OBS-URL: https://build.opensuse.org/package/show/KDE:Qt/python-sip?expand=0&rev=146
This commit is contained in:
Mikhail Terekhov 2017-03-11 19:15:23 +00:00 committed by Git OBS Bridge
parent a146a1a393
commit 407fc5e200
4 changed files with 134 additions and 492 deletions

View File

@ -1,3 +1,32 @@
-------------------------------------------------------------------
Sat Mar 11 03:51:53 UTC 2017 - toddrme2178@gmail.com
- Fix sip api macro.
- Fix header location.
- Compile and install .pyc files.
-------------------------------------------------------------------
Wed Mar 8 16:36:29 UTC 2017 - toddrme2178@gmail.com
- spec file cleanups
- better use of multipython macros
- include more documentation
-------------------------------------------------------------------
Mon Mar 6 16:21:09 UTC 2017 - toddrme2178@gmail.com
- Add shared data directory and corresponding package.
-------------------------------------------------------------------
Wed Mar 1 16:08:40 UTC 2017 - toddrme2178@gmail.com
- Fix python library handling.
-------------------------------------------------------------------
Mon Feb 27 19:37:19 UTC 2017 - toddrme2178@gmail.com
- Switch to single spec version.
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Feb 16 18:48:11 UTC 2017 - termim@gmail.com Thu Feb 16 18:48:11 UTC 2017 - termim@gmail.com

View File

@ -16,9 +16,10 @@
# #
%define python_sip_api 12.1 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-sip Name: python-sip
Version: 4.19.1 Version: 4.19.1
%define python_sip_api 12.1
Release: 0 Release: 0
Summary: SIP tool to use python sip bindings Summary: SIP tool to use python sip bindings
License: GPL-2.0 or GPL-3.0 or SUSE-SIP License: GPL-2.0 or GPL-3.0 or SUSE-SIP
@ -28,11 +29,18 @@ Source0: sip-%{version}.tar.gz
# PATCH-FIX-OPENSUSE disable-rpaths.diff -- Disable rpaths # PATCH-FIX-OPENSUSE disable-rpaths.diff -- Disable rpaths
Patch0: disable-rpaths.diff Patch0: disable-rpaths.diff
BuildRequires: c++_compiler BuildRequires: c++_compiler
BuildRequires: python BuildRequires: python-rpm-macros
BuildRequires: python-devel BuildRequires: %{python_module devel}
Provides: python-sip(api) = %{python_sip_api} Requires: %{name}-common = %{version}
%ifpython2
Provides: %{python2_prefix}-sip(api) = %{python_sip_api}
%endif
%ifpython3
Provides: %{python3_prefix}-sip(api) = %{python_sip_api}
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
%py_requires
%python_subpackages
%description %description
SIP is a tool that makes it very easy to create Python bindings for C SIP is a tool that makes it very easy to create Python bindings for C
@ -40,15 +48,17 @@ and C++ libraries. It was originally developed to create PyQt, the
Python bindings for the Qt toolkit, but can be used to create bindings Python bindings for the Qt toolkit, but can be used to create bindings
for any C or C++ library. for any C or C++ library.
%package devel %package devel
Summary: SIP tool to create python bindings Summary: SIP tool to create python bindings
Group: Development/Libraries/Python Group: Development/Libraries/Python
Requires: %{name} = %{version} Requires: %{name} = %{version}
Requires: c++_compiler Requires: c++_compiler
Requires: python-devel Requires: python-devel
Provides: %{name}-bin = %{version}
Obsoletes: %{name}-bin < %{version}
Requires(post): update-alternatives Requires(post): update-alternatives
Provides: python-sip-bin = %{version} Requires(postun): update-alternatives
Obsoletes: python-sip-bin < %{version}
%description devel %description devel
SIP is a tool that makes it very easy to create Python bindings for C SIP is a tool that makes it very easy to create Python bindings for C
@ -59,17 +69,25 @@ for any C or C++ library.
This package contains all the developer tools you need to create your This package contains all the developer tools you need to create your
own sip bindings. own sip bindings.
%package -n %{name}-common
Summary: SIP tool to create python bindings -- common files
Provides: %{python_module sip-common = %{version}}
%description -n python-sip-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 %prep
%setup -q -n sip-%{version} %setup -q -n sip-%{version}
%patch0 -p1 %patch0 -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_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}') sip_minor=$(grep "define SIP_API_MINOR_NR" siplib/sip.h.in | awk '{print $3}')
@ -78,48 +96,92 @@ if test "%{python_sip_api}" != "$sip_major.$sip_minor"; then
exit 1 exit 1
fi fi
echo "%%requires_python_sip_api Requires: python-sip(api) = $sip_major.$sip_minor" > macros.%{name}
%install %build
make DESTDIR=%{buildroot} install %{?_smp_mflags} export CFLAGS="%{optflags}"
mkdir -p %{buildroot}%{_datadir}/sip export CXXFLAGS="%{optflags}"
# For alternatives %{python_expand mkdir build_%{$python_bin_suffix}
mv %{buildroot}%{_bindir}/sip %{buildroot}%{_bindir}/sip-%{py_ver} pushd build_%{$python_bin_suffix}
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} # 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 # Point to the correct location for the documentation files
sed -i 's/"doc" directory/"doc" directory of package %{name}-devel/' README 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) = $sip_major.$sip_minor" > %{buildroot}/%{_sysconfdir}/rpm/macros.%{python3_prefix}-sip
%py3_compile %{buildroot}%{python3_sitearch}
%endif
%prepare_alternative sip
mkdir -p %{buildroot}%{_datadir}/sip
%post devel %post devel
update-alternatives --install %{_bindir}/sip sip %{_bindir}/sip-%{py_ver} 50 %{python_install_alternative sip}
%preun devel %postun devel
%python_uninstall_alternative sip
if [ "$1" = 0 ] ; then
update-alternatives --remove sip %{_bindir}/sip-%{py_ver}
fi
%files %files %{python_files}
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc README %doc ChangeLog LICENSE* NEWS
%{py_sitedir}/sip.so %doc doc/
%doc build_%{python_bin_suffix}/README
%{python_sitearch}/sip.so
%files devel
%files %{python_files devel}
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc NEWS LICENSE* doc/ %doc LICENSE*
%config %{_sysconfdir}/rpm/macros.%{name} %config %{_sysconfdir}/rpm/macros.%{python_prefix}-sip
%{_bindir}/sip-%{py_ver} %python_alternative %{_bindir}/sip
%ghost %{_sysconfdir}/alternatives/sip %{_includedir}/python%{python_version}*/sip.h
%{_bindir}/sip %{python_sitearch}/sipconfig.py*
%{py_incdir}/sip.h %{python_sitearch}/sipdistutils.py*
%{py_sitedir}/sipconfig.py %{python_sitearch}/sip.pyi
%{py_sitedir}/sipdistutils.py %pycache_only %{python_sitearch}/__pycache__/sipconfig.*.py*
%{py_sitedir}/sip.pyi %pycache_only %{python_sitearch}/__pycache__/sipdistutils.*.py*
%files -n python-sip-common
%defattr(-,root,root,-)
%doc LICENSE*
%{_datadir}/sip/ %{_datadir}/sip/
%changelog %changelog

View File

@ -1,322 +0,0 @@
-------------------------------------------------------------------
Mon Feb 20 13:34:17 UTC 2017 - dimstar@opensuse.org
- Use pkgconfig to find the correct lib to link for python3.
- Properly define py3_incdir.
-------------------------------------------------------------------
Thu Feb 16 18:48:11 UTC 2017 - termim@gmail.com
- Update to 4.19.1
* Added the %PreMethodCode directive.
* Added sipEnableGC() to the C API.
* Added the -D command line option so that the generated code is
aware of Python debug builds.
-------------------------------------------------------------------
Tue Jan 3 19:08:18 UTC 2017 - termim@gmail.com
- Update to 4.19
* added the assign() function to the sip module
* added support for the final keyword
* added the use_limited_api argument to the %Module directive
* added the %HideNamespace directive.
-------------------------------------------------------------------
Tue Jul 26 17:27:37 UTC 2016 - termim@gmail.com
- Update to 4.18.1
* Bug fixes
-------------------------------------------------------------------
Mon Jul 4 05:09:07 UTC 2016 - hpj@urpla.net
- removed build-compare.diff: it is the default since 4.18 anyway
- disable-rpaths.diff refreshed
-------------------------------------------------------------------
Wed May 11 14:30:46 UTC 2016 - termim@gmail.com
- Update to 4.18 This implements the automatic generation of PEP 484 type
hint files. The sip extension module is available as a wheel from PyPi.
* Added the /TypeHint/ argument, class, mapped type, function, typedef
and variable annotations.
* Added the /TypeHintIn/ and /TypeHintOut/ argument, class, mapped type
and typedef annotations.
* Added the /TypeHintValue/ argument, class and mapped type annotations.
* Added the /NoTypeHint/ class, enum, function and variable annotations.
* Added the %ExportedTypeHintCode and %TypeHintCode directives.
* Added the -f command line option to treat warnings as errors.
* Added the -y command line option to generated PEP 484 compatible type
hint stub files.
* Deprecated the /DocType/ and /DocValue/ annotations.
-------------------------------------------------------------------
Fri Oct 30 17:56:19 UTC 2015 - termim@gmail.com
- Update to 4.17.0
* This version adds support for PEP 465, PEP 492 and MSVC 2015.
-------------------------------------------------------------------
Mon Jul 20 18:04:55 UTC 2015 - termim@gmail.com
- Update to 4.16.9:
* This is mainly a bug-fix release.
-------------------------------------------------------------------
Sat Jun 13 22:22:47 UTC 2015 - termim@gmail.com
- Update to 4.16.8:
* This is mainly a bug-fix release.
- Update to 4.16.7:
* This is a minor functional and bug-fix release.
- Update to 4.16.6:
* Added the /FileExtension/ class annotation.
* Installing into a virtual env should now work.
* Timestamps are no longer included in generated code. The -T command
line option is now ignored and deprecated.
* The @file method of passing additional command line options is now
supported. The -z command line option is now deprecated.
-------------------------------------------------------------------
Tue Dec 30 20:24:04 UTC 2014 - hrvoje.senjan@gmail.com
- Update to 4.16.5:
* Minor functional and bug-fix release.
- Changes since 4.16.4:
* Added the /AbortOnException/ function annotation.
* Added the /DisallowNone/ function annotation.
* Added the /DisallowNone/ argument annotation.
-------------------------------------------------------------------
Sat Oct 11 17:01:01 UTC 2014 - termim@gmail.com
- Update to 4.16.3
- This is a minor functional release including the implementation of
__qualname__ for class enums.
- run spec-cleaner
-------------------------------------------------------------------
Thu Jul 31 08:45:26 UTC 2014 - toddrme2178@gmail.com
- Update to 4.16.2
- Deprecated the %ConsolidatedModule directive as it won't be supported in
SIP v5.
- Bug fixes.
-------------------------------------------------------------------
Tue Jun 10 03:02:59 UTC 2014 - termim@gmail.com
- Update to 4.16.1
- Bug fixes.
-------------------------------------------------------------------
Thu May 29 02:12:07 UTC 2014 - termim@gmail.com
- Update to 4.16
- Added the /NoSetter/ variable annotation.
- Added the -B option to sip.
- Changed the handling of timelines (introducing a potential incompatibility)
so that later versions of wrapped libraries can be wrapped so long as they
are compatible with known versions.
- Added support for the 'no_receiver_check' argument to connect() in PyQt
v4.11.
- Added the --configuration option to configure.py.
- Added the --sysroot option to configure.py.
- Added the --target-py-version option to configure.py.
- Added the --no-tools option to configure.py.
- Added the --use-qmake option to configure.py.
- Bug fixes.
-------------------------------------------------------------------
Mon Mar 17 07:00:40 UTC 2014 - termim@gmail.com
- Update to 4.15.5
- The use_arch argument of sipconfig.create_wrapper() can now specify a space
separated set of architectures.
- Bug fixes.
-------------------------------------------------------------------
Fri Jan 10 19:39:29 UTC 2014 - lbeltrame@kde.org
- Fix SNAFU in preun scriptlet (missing spaces)
-------------------------------------------------------------------
Thu Jan 9 20:09:03 UTC 2014 - lbeltrame@kde.org
- New upstream version 4.15.4:
- Fixed all the compiler warning messages when building the sip module.
- Fixed the parsing of C++ types involving multiple const and pointers.
- Added SIP_SSIZE_T_FORMAT to the C API.
- Moved the lexer and parser meta-source files to a separate directory to avoid
problems with make accidentaly regenerating them.
- Allow the pointers used to store the parsed results from Python
reimplementations to be NULL.
- Remove the __pycache__ directory when cleaning.
-------------------------------------------------------------------
Sun Oct 20 07:42:54 UTC 2013 - lbeltrame@kde.org
- Use alternatives for /usr/bin/sip to prevent conflicts between
Python 3 and Python 2 python-sip-devel packages
-------------------------------------------------------------------
Thu Oct 17 12:41:50 UTC 2013 - toddrme2178@gmail.com
- update to v4.15.3. This is a bug fix release for a regression
that affects PyQtChart.
-------------------------------------------------------------------
Tue Sep 24 09:42:26 UTC 2013 - toddrme2178@gmail.com
- Fix building on openSUSE 12.2. The approach is kind of ugly,
but it is the only way I can find that works. Feel free to improve
it.
-------------------------------------------------------------------
Thu Sep 19 10:37:30 UTC 2013 - toddrme2178@gmail.com
- update to v4.15.2. This is a minor functional release that will
be needed by PyQt v5.1. It also contains bug fixes needed by
PyKDE4.
-------------------------------------------------------------------
Tue Sep 17 13:31:52 UTC 2013 - speilicke@suse.com
- Revert sr#79987, moving /usr/bin/sip into python-sip-bin and requiring
that in python3-sip-devel (plus split provides) only causes trouble. It will
make python3-sip-devel depend forever on Python2 for absolutely no reason.
Both python-sip-devel and python3-sip-devel can happily provide /usr/bin/sip
since the binary is identical. You can have both installed in parallel and
remove either without breaking anything. (bnc#835161)
-------------------------------------------------------------------
Wed Sep 11 06:49:37 UTC 2013 - tittiatcoke@gmail.com
- Build issues are resolved with the Python KDE bindings. Return
to version 4.15.1
-------------------------------------------------------------------
Fri Aug 30 14:36:12 UTC 2013 - tittiatcoke@gmail.com
- Revert back to version 4,14,7 to prevent crashes in Plasma-desktop
(bko#323899).
-------------------------------------------------------------------
Tue Aug 27 03:31:58 UTC 2013 - termim@gmail.com
- update to 4.15.1. This fixes a regression in v4.15 related to the handling of hidden virtual methods. The regression does not affect PyQt.
- update to v4.15. This is a significant functional release and required by PyQt v5.0.1 and PyQt v4.10.3.
- Added the call_super_init argument to the %Module directive to specify that classes should support cooperative multi-inheritance.
- Added the %FinalisationCode directive.
- Added the /Mixin/ class annotation.
- Added the /NoScope/ enum annotation.
- Added sipConvertFromNewPyType() to the C API.
- Added sipConvertToArray() and sipConvertToTypedArray() to the C API.
- Added sipRegisterProxyResolver() to the C API.
-------------------------------------------------------------------
Thu Mar 7 02:57:09 UTC 2013 - mlin@suse.com
- Update to 4.14.4
* bugfix release
* include a potential incompatibility in the use of the %VirtualErrorHandler directive.
-------------------------------------------------------------------
Sun Dec 9 13:44:20 UTC 2012 - lbeltrame@kde.org
- Update to 4.14.2:
- Added sip.setdestroyonexit().
- sip.voidptr() will now accept any object that implements the buffer
protocol.
-------------------------------------------------------------------
Thu Nov 22 14:18:55 UTC 2012 - toddrme2178@gmail.com
- Removed openSUSE 11.4 spec file workarounds
-------------------------------------------------------------------
Mon Oct 29 09:55:09 UTC 2012 - dmueller@suse.com
- update to 4.14.1:
- SIP_PYBUFFER can now be used to define objects that implement the Python
buffer protocol.
- Added /Capsule/ typedef annotation.
- Added the 'z' format character to sipBuildResult().
- Added the 'z', '!' and '$' format characters to sipParseResult().
- The C prototype foo(void) is now accepted.
- sipdistutils.py will now include swig_opts if no sip_opts have been
defined.
- Bug fixes.
-------------------------------------------------------------------
Mon Oct 1 05:43:35 UTC 2012 - einar@heavensinferno.net
- Update to the latest upstream version:
- The internal API version is increased to 9.0 requiring the regeneration
of all modules.
- Added the %InstanceCode directive.
- Added the %VirtualErrorHandler directive.
- Added the default_VirtualErrorHandler argument to the %Module directive.
- Added the VirtualErrorHandler class annotation.
- Added the NoVirtualErrorHandler and VirtualErrorHandler function
annotations.
- The AllowNone and NoRelease mapped type annotations can now be used
with mapped type templates.
- SIP_PLATFORM_* and SIP_TIMELINE_* preprocessor symbols are generated
corresponding to the -t arguments passed on the command line.
- Deprecated sipTransferBreak().
- For Python v2.x unsigned short and unsigned char (when used as a byte)
are now converted to int, rather than long, objects.
- Added support for MSVC 2010 to the build system.
-------------------------------------------------------------------
Thu Jul 5 12:30:36 UTC 2012 - dmueller@suse.com
- install api version as rpm macro
-------------------------------------------------------------------
Fri Jun 22 02:59:36 UTC 2012 - mlin@suse.com
- Update to version 4.13.3
- The /NoRaisesPyException/ and /RaisesPyException/ function annotations can
now be applied to constructors.
- Added support for the Python v3.3 handling of Unicode.
-------------------------------------------------------------------
Wed Apr 11 13:40:14 UTC 2012 - asterios.dramis@gmail.com
- Link against libpython. Fixes bnc#756282 and bnc#721280.
- license update: GPL-2.0 or GPL-3.0 or SUSE-SIP
Use SUSE- proprietary extension until SIP license is accepted upstream at
spdx.org
- Remove SUSE_ASNEEDED=0 from spec file.
-------------------------------------------------------------------
Mon Nov 21 10:33:26 UTC 2011 - cgiboudeaux@gmx.com
- Define python3_sitearch (fixes the <12.1 build)
- Spec cleanup
-------------------------------------------------------------------
Wed Oct 26 20:19:38 UTC 2011 - Sascha.Manns@open-slx.de
- Update to 4.13
- last stable release
-------------------------------------------------------------------
Mon Aug 29 18:41:49 UTC 2011 - termim@gmail.com
- Add python-sip-bin package to avoid conflicts between python2
and python3 versions
-------------------------------------------------------------------
Tue Aug 16 00:07:23 UTC 2011 - termim@gmail.com
- Update to 4.12.4
- A bug fix release.
- Adapted python-sip.spec for python3

View File

@ -1,127 +0,0 @@
#
# spec file for package python3-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
%define py3_incdir %(python3 -c "from distutils import sysconfig; print (sysconfig.get_python_inc())")
Name: python3-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/intro
Source0: sip-%{version}.tar.gz
# PATCH-FIX-OPENSUSE disable-rpaths.diff -- Disable rpaths
Patch0: disable-rpaths.diff
BuildRequires: c++_compiler
BuildRequires: python3-devel
Requires(pre): python3
Requires(pre): python3-base
Provides: python3-sip(api) = %{python_sip_api}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%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: python3-devel
Requires(post): update-alternatives
Provides: python3-sip-bin = %{version}
Obsoletes: python3-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-%{version}
%patch0 -p1
%build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
# Link against libpython (fixes bnc#756282 and bnc#721280)
python3 configure.py --debug CFLAGS+="%{optflags}" CXXFLAGS+="%{optflags}" LIBS+="$(pkg-config --libs python3)"
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_python3_sip_api Requires: python3-sip(api) = $sip_major.$sip_minor" > macros.%{name}
%install
%make_install
mkdir -p %{buildroot}%{_datadir}/sip
# For alternatives
mv %{buildroot}%{_bindir}/sip %{buildroot}%{_bindir}/sip-%{py3_ver}
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
touch %{buildroot}%{_sysconfdir}/alternatives/sip
ln -s -f %{_sysconfdir}/alternatives/sip %{buildroot}/%{_bindir}/sip
# Point to the correct location for the documentation files
sed -i 's/"doc" directory/"doc" directory of package %{name}-devel/' README
install -m 644 -D macros.%{name} %{buildroot}/%{_sysconfdir}/rpm/macros.%{name}
%post devel
# Lower priority than the python 2.x version for now
update-alternatives --install %{_bindir}/sip sip %{_bindir}/sip-%{py3_ver} 40
%preun devel
if [ "$1" = 0 ] ; then
update-alternatives --remove sip %{_bindir}/sip-%{py3_ver}
fi
%files
%defattr(-,root,root,-)
%doc README
%{python3_sitearch}/sip.so
%files devel
%defattr(-,root,root,-)
%doc NEWS LICENSE* doc/
%config %{_sysconfdir}/rpm/macros.%{name}
%{_bindir}/sip-%{py3_ver}
%ghost %{_sysconfdir}/alternatives/sip
%{_bindir}/sip
%{py3_incdir}/sip.h
%{python3_sitearch}/sipconfig.py
%{python3_sitearch}/sipdistutils.py
%{python3_sitearch}/sip.pyi
%{_datadir}/sip/
%changelog