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