This commit is contained in:
Petr Viktorin 2017-08-15 14:39:17 +02:00 committed by Iryna Shcherbina
parent 290194b14e
commit 6580f3c0dd

View File

@ -1,16 +1,20 @@
%bcond_without python2
%if 0%{?rhel} && 0%{?rhel} <= 7
# Do not build bindings for python3 for RHEL <= 7
%bcond_with python3
# python-flask is not in RHEL7
%bcond_with tests
# platform-python is not in RHEL7
%bcond_with platform_python
%else
%bcond_without python3
%bcond_without platform_python
%bcond_without tests
%endif
Name: librepo
Version: 1.7.20
Release: 7%{?dist}
Release: 8%{?dist}
Summary: Repodata downloading library
License: LGPLv2+
@ -39,6 +43,7 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
Development files for librepo.
%if %{with python2}
%package -n python2-%{name}
Summary: Python bindings for the librepo library
%{?python_provide:%python_provide python2-%{name}}
@ -54,11 +59,11 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n python2-%{name}
Python 2 bindings for the librepo library.
%endif # with python2
%if %{with python3}
%package -n python3-%{name}
Summary: Python 3 bindings for the librepo library
%{?system_python_abi}
%{?python_provide:%python_provide python3-%{name}}
BuildRequires: python3-pygpgme
BuildRequires: python3-devel
@ -74,16 +79,29 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
Python 3 bindings for the librepo library.
%endif
%if %{with platform_python}
%package -n platform-python-%{name}
Summary: Platform Python bindings for the librepo library
BuildRequires: platform-python-devel
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n platform-python-%{name}
Python 3 bindings for the librepo library.
%endif # with platform_python
%prep
%autosetup -n %{name}-%{name}-%{version}
mkdir build build-py3
mkdir build build-py3 build-platpy
%build
%if %{with python2}
pushd build
%cmake ..
%make_build
popd
%endif # with python2
%if %{with python3}
pushd build-py3
@ -92,25 +110,66 @@ pushd build-py3
popd
%endif
%if %{with platform_python}
pushd build-platpy
# librepo's CMakeLists override CMake's override mechanism!
# Bring it back.
sed '/unset(PYTHON_[^)]*)/d' -i ../librepo/python/python3/CMakeLists.txt
export python_so=%{_libdir}/`%{__platform_python} -c 'import sysconfig; print(sysconfig.get_config_var("LDLIBRARY"))'`
export python_include=`%{__platform_python} -c 'import sysconfig; print(sysconfig.get_path("include"))'`
%cmake \
-DPYTHON_EXECUTABLE:FILEPATH=%{__platform_python} \
-DPYTHON_LIBRARY=$python_so \
-DPYTHON_INCLUDE_DIR=$python_include \
-DPYTHON_DESIRED:str=3 \
..
%make_build
popd
%endif # with platform_python
%if %{with tests}
%check
%if %{with python2}
pushd build
#ctest -VV
make ARGS="-V" test
popd
%endif # with python2
%if %{with python3}
pushd build-py3
#ctest -VV
make ARGS="-V" test
popd
%endif
%endif
%endif # with python3
%if %{with platform_python}
pushd build-platpy
#ctest -VV
# Test suite requires the "nosetests" binary
#make ARGS="-V" test
popd
%endif # with platform_python
%endif # with tests
%install
%if %{with platform_python}
pushd build-platpy
%make_install
popd
%endif # with platform_python
%if %{with python2}
pushd build
%make_install
popd
%endif # with python2
%if %{with python3}
pushd build-py3
%make_install
@ -131,15 +190,25 @@ popd
%{_libdir}/pkgconfig/%{name}.pc
%{_includedir}/%{name}/
%if %{with python2}
%files -n python2-%{name}
%{python2_sitearch}/%{name}/
%endif # with python2
%if %{with python3}
%files -n python3-%{name}
%{python3_sitearch}/%{name}/
%endif
%if %{with platform_python}
%files -n platform-python-%{name}
%{platform_python_sitearch}/%{name}/
%endif # with platform_python
%changelog
* Thu Aug 10 2017 Petr Viktorin <pviktori@redhat.com> - 1.7.20-8
- Add subpackage for platform-python (https://fedoraproject.org/wiki/Changes/Platform_Python_Stack)
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.20-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild