Add Python 3 conditionals

This commit is contained in:
Pete Walter 2017-04-10 22:39:59 +01:00
parent c48577da5c
commit 1ec0be87c7

View File

@ -1,3 +1,7 @@
%if 0%{?fedora}
%global with_python3 1
%endif
%global pkgname pygit2 %global pkgname pygit2
Name: python-%{pkgname} Name: python-%{pkgname}
@ -37,6 +41,7 @@ the core of Git.
Python 2 version. Python 2 version.
%if 0%{?with_python3}
%package -n python3-%{pkgname} %package -n python3-%{pkgname}
Summary: Python 3.x bindings for libgit2 Summary: Python 3.x bindings for libgit2
%{?python_provide:%python_provide python3-%{pkgname}} %{?python_provide:%python_provide python3-%{pkgname}}
@ -53,6 +58,7 @@ pygit2 is a set of Python bindings to the libgit2 library, which implements
the core of Git. the core of Git.
Python 3 version. Python 3 version.
%endif
%package doc %package doc
@ -71,12 +77,18 @@ Documentation for %{name}.
%build %build
%py2_build %py2_build
make -C docs html make -C docs html
%if 0%{?with_python3}
%py3_build %py3_build
%endif
%install %install
%py2_install %py2_install
%if 0%{?with_python3}
%py3_install %py3_install
%endif
find %{_builddir} -name '.buildinfo' -delete find %{_builddir} -name '.buildinfo' -delete
@ -86,7 +98,10 @@ find %{buildroot} -name '*.so' -exec chmod 755 {} ';'
%check %check
%{__python2} setup.py test %{__python2} setup.py test
%if 0%{?with_python3}
%{__python3} setup.py test %{__python3} setup.py test
%endif
%files -n python2-%{pkgname} %files -n python2-%{pkgname}
@ -96,12 +111,14 @@ find %{buildroot} -name '*.so' -exec chmod 755 {} ';'
%{python2_sitearch}/%{pkgname} %{python2_sitearch}/%{pkgname}
%{python2_sitearch}/_%{pkgname}.so %{python2_sitearch}/_%{pkgname}.so
%if 0%{?with_python3}
%files -n python3-%{pkgname} %files -n python3-%{pkgname}
%doc README.rst TODO.txt %doc README.rst TODO.txt
%license COPYING %license COPYING
%{python3_sitearch}/%{pkgname}-%{version}-py%{python3_version}.egg-info %{python3_sitearch}/%{pkgname}-%{version}-py%{python3_version}.egg-info
%{python3_sitearch}/%{pkgname} %{python3_sitearch}/%{pkgname}
%{python3_sitearch}/_%{pkgname}.*.so %{python3_sitearch}/_%{pkgname}.*.so
%endif
%files doc %files doc
%license COPYING %license COPYING
@ -111,6 +128,7 @@ find %{buildroot} -name '*.so' -exec chmod 755 {} ';'
%changelog %changelog
* Mon Apr 10 2017 Pete Walter <pwalter@fedoraproject.org> - 0.25.0-3 * Mon Apr 10 2017 Pete Walter <pwalter@fedoraproject.org> - 0.25.0-3
- Trivial spec file fixes - Trivial spec file fixes
- Add Python 3 conditionals
* Tue Feb 07 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.25.0-2 * Tue Feb 07 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.25.0-2
- Bump release for rebuild - Bump release for rebuild