diff --git a/python-pygit2.spec b/python-pygit2.spec index 72828fc..0a4bbef 100644 --- a/python-pygit2.spec +++ b/python-pygit2.spec @@ -1,3 +1,7 @@ +%if 0%{?fedora} || 0%{?rhel} > 7 +%global with_python3 1 +%endif + %global pkgname pygit2 Name: python-%{pkgname} @@ -16,6 +20,7 @@ BuildRequires: libgit2-devel pygit2 is a set of Python bindings to the libgit2 library, which implements the core of Git. + %package -n python2-%{pkgname} Summary: Python 2.x bindings for libgit2 %{?python_provide:%python_provide python2-%{pkgname}} @@ -32,6 +37,8 @@ the core of Git. Python 2 version. + +%if 0%{?with_python3} %package -n python3-%{pkgname} Summary: Python 3.x bindings for libgit2 %{?python_provide:%python_provide python3-%{pkgname}} @@ -47,6 +54,8 @@ pygit2 is a set of Python bindings to the libgit2 library, which implements the core of Git. Python 3 version. +%endif + %package doc Summary: Documentation for %{name} @@ -56,34 +65,49 @@ BuildRequires: %{_bindir}/sphinx-build %description doc Documentation for %{name}. + %prep %autosetup -n %{pkgname}-%{version} -p1 + %build %py2_build make -C docs html + +%if 0%{?with_python3} %py3_build +%endif + %install %py2_install + +%if 0%{?with_python3} %py3_install +%endif find %{_builddir} -name '.buildinfo' -delete # Correct the permissions. find %{buildroot} -name '*.so' -exec chmod 755 {} ';' + %check # https://github.com/libgit2/pygit2/issues/811 # https://github.com/libgit2/pygit2/issues/812 %ifarch aarch64 ppc64 s390x %{__python2} setup.py test || : + %if 0%{?with_python3} %{__python3} setup.py test || : + %endif %else %{__python2} setup.py test + %if 0%{?with_python3} %{__python3} setup.py test + %endif %endif + %files -n python2-%{pkgname} %doc README.rst TODO.txt %license COPYING @@ -91,17 +115,20 @@ find %{buildroot} -name '*.so' -exec chmod 755 {} ';' %{python2_sitearch}/%{pkgname}/ %{python2_sitearch}/_%{pkgname}.so +%if 0%{?with_python3} %files -n python3-%{pkgname} %doc README.rst TODO.txt %license COPYING %{python3_sitearch}/%{pkgname}-*.egg-info/ %{python3_sitearch}/%{pkgname}/ %{python3_sitearch}/_%{pkgname}.*.so +%endif %files doc %license COPYING %doc docs/_build/html/* + %changelog * Fri Aug 10 2018 Igor Gnatenko - 0.27.1-1 - Update to 0.27.1