Add Platform Python subpackage

As part of Platform Python Stack change (https://fedoraproject.org/wiki/Changes/Platform_Python_Stack)
This commit is contained in:
Iryna Shcherbina 2017-08-15 10:45:50 +02:00
parent b6830e2884
commit 5fe4e61282

View File

@ -4,9 +4,12 @@
%bcond_without python3 %bcond_without python3
%endif %endif
%bcond_without python2
%bcond_without platform_python
Name: libcomps Name: libcomps
Version: 0.1.8 Version: 0.1.8
Release: 5%{?dist} Release: 6%{?dist}
Summary: Comps XML file manipulation library Summary: Comps XML file manipulation library
License: GPLv2+ License: GPLv2+
@ -39,6 +42,7 @@ BuildRequires: doxygen
%description doc %description doc
Documentation files for libcomps library. Documentation files for libcomps library.
%if %{with python2}
%package -n python-%{name}-doc %package -n python-%{name}-doc
Summary: Documentation files for python bindings libcomps library Summary: Documentation files for python bindings libcomps library
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
@ -56,63 +60,114 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n python2-%{name} %description -n python2-%{name}
Python 2 bindings for libcomps library. Python 2 bindings for libcomps library.
%endif # with python2
%if %{with python3} %if %{with python3}
%package -n python3-%{name} %package -n python3-%{name}
Summary: Python 3 bindings for libcomps library Summary: Python 3 bindings for libcomps library
BuildRequires: python3-devel BuildRequires: python3-devel
%{?system_python_abi}
%{?python_provide:%python_provide python3-%{name}} %{?python_provide:%python_provide python3-%{name}}
Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n python3-%{name} %description -n python3-%{name}
Python3 bindings for libcomps library. Python3 bindings for libcomps library.
%endif %endif # with python3
%if %{with platform_python}
%package -n platform-python-%{name}
Summary: Platform Python bindings for libcomps library
BuildRequires: platform-python-devel
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n platform-python-%{name}
Platform Python bindings for libcomps library.
%endif # with platform_python
%prep %prep
%autosetup -n %{name}-%{name}-%{version} %autosetup -n %{name}-%{name}-%{version}
mkdir build %if %{with python2}
mkdir build-py2
%endif # with python2
%if %{with python3} %if %{with python3}
mkdir build-py3 mkdir build-py3
%endif %endif # with python3
%if %{with platform_python}
mkdir build-platform_python
%endif # with platform_python
%build %build
pushd build %if %{with python2}
pushd build-py2
%cmake ../libcomps/ -DPYTHON_DESIRED:STRING=2 %cmake ../libcomps/ -DPYTHON_DESIRED:STRING=2
%make_build %make_build
make %{?_smp_mflags} docs make %{?_smp_mflags} docs
make %{?_smp_mflags} pydocs make %{?_smp_mflags} pydocs
popd popd
%endif # with python2
%if %{with python3} %if %{with python3}
pushd build-py3 pushd build-py3
%cmake ../libcomps/ -DPYTHON_DESIRED:STRING=3 %cmake ../libcomps/ -DPYTHON_DESIRED:STRING=3
%make_build %make_build
popd popd
%endif %endif # with python3
%if %{with platform_python}
pushd build-platform_python
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 \
../libcomps/ \
-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
%install %install
pushd build %if %{with python2}
pushd build-py2
%make_install %make_install
popd popd
%endif # with python2
%if %{with python3} %if %{with python3}
pushd build-py3 pushd build-py3
%make_install %make_install
popd popd
%endif %endif # with python3
%if %{with platform_python}
pushd build-platform_python
%make_install
popd
%endif # with platform_python
%check %check
pushd build %if %{with python2}
pushd build-py2
make test make test
popd popd
%endif # with python2
%if %{with python3} %if %{with python3}
pushd build-py3 pushd build-py3
make pytest make pytest
popd popd
%endif %endif # with python3
%if %{with platform_python}
pushd build-platform_python
# Tests are Python 3 incompatible and they are
# skipped internally for Python 3 as well.
#make pytest
popd
%endif # with platform_python
%post -p /sbin/ldconfig %post -p /sbin/ldconfig
%postun -p /sbin/ldconfig %postun -p /sbin/ldconfig
@ -126,21 +181,31 @@ popd
%{_libdir}/%{name}.so %{_libdir}/%{name}.so
%{_includedir}/%{name}/ %{_includedir}/%{name}/
%if %{with python2}
%files doc %files doc
%doc build/docs/libcomps-doc/html %doc build-py2/docs/libcomps-doc/html
%files -n python-%{name}-doc %files -n python-%{name}-doc
%doc build/src/python/docs/html %doc build-py2/src/python/docs/html
%files -n python2-%{name} %files -n python2-%{name}
%{python2_sitearch}/%{name}/ %{python2_sitearch}/%{name}/
%endif # with python2
%if %{with python3} %if %{with python3}
%files -n python3-%{name} %files -n python3-%{name}
%{python3_sitearch}/%{name}/ %{python3_sitearch}/%{name}/
%endif %endif # with python3
%if %{with platform_python}
%files -n platform-python-%{name}
%{platform_python_sitearch}/%{name}/
%endif # with platform_python
%changelog %changelog
* Thu Aug 10 2017 Lumír Balhar <lbalhar@redhat.com> - 0.1.8-6
- Add Platform Python subpackage (https://fedoraproject.org/wiki/Changes/Platform_Python_Stack)
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.8-5 * Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.8-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
@ -283,4 +348,3 @@ popd
* Tue Jun 25 2013 Jindrich Luza <jluza@redhat.com> 0.1.1-1 * Tue Jun 25 2013 Jindrich Luza <jluza@redhat.com> 0.1.1-1
- Automatic commit of package [libcomps] release [0.1.1-1]. - Automatic commit of package [libcomps] release [0.1.1-1].