From 38feb369af424feab11a31afb8b9037d3b1f0e3c Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Jan 14 2015 19:14:11 +0000 Subject: Conditionalize python3 subpackage for EPEL. --- diff --git a/python-pygit2.spec b/python-pygit2.spec index 87b7422..aa5b28b 100644 --- a/python-pygit2.spec +++ b/python-pygit2.spec @@ -1,8 +1,19 @@ +%if 0%{?fedora} +%global with_python3 1 +%endif + +# Define modern python2 macros for el6. +%if 0%{?rhel} && 0%{?rhel} <= 6 +%{!?__python2: %global __python2 /usr/bin/python2} +%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} +%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} +%endif + %global pkgname pygit2 Name: python-%{pkgname} Version: 0.21.4 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Python 2.x bindings for libgit2 URL: http://www.pygit2.org Source: http://pypi.python.org/packages/source/p/%{pkgname}/%{pkgname}-%{version}.tar.gz @@ -23,6 +34,7 @@ pygit2 is a set of Python bindings to the libgit2 library, which implements the core of Git. Pygit2 works with Python 2.7, 3.1, 3.2, 3.3 and 3.4. +%if 0%{?with_python3} %package -n python3-%{pkgname} Summary: Python 3.x bindings for libgit2 BuildRequires: python3-cffi @@ -36,6 +48,9 @@ Requires: python3-cffi pygit2 is a set of Python bindings to the libgit2 library, which implements the core of Git. Pygit2 works with Python 2.7, 3.1, 3.2, 3.3 and 3.4. +This is the python3 subpackage. +%endif + %package doc Summary: Documentation for %{name} @@ -52,24 +67,32 @@ Documentation for %{name}. %patch0 -p1 +%if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} +%endif %build CFLAGS="%{optflags}" %{__python2} setup.py build make -C docs html +%if 0%{?with_python3} pushd %{py3dir} CFLAGS="%{optflags}" %{__python3} setup.py build popd +%endif %install %{__python2} setup.py install --prefix=%{_prefix} -O1 --skip-build --root=%{buildroot} + +%if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install --prefix=%{_prefix} -O1 --skip-build --root=%{buildroot} popd +%endif + find %{_builddir} -name '.buildinfo' -delete # Correct the permissions. find %{buildroot} -name '*.so' -exec chmod 755 {} ';' @@ -77,9 +100,12 @@ find %{buildroot} -name '*.so' -exec chmod 755 {} ';' %check %{__python2} setup.py test + +%if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py test popd +%endif %files @@ -90,6 +116,7 @@ popd %{python2_sitearch}/_%{pkgname}.so %{python2_sitearch}/%{pkgname}_cffi_*.so +%if 0%{?with_python3} %files -n python3-%{pkgname} %doc README.rst TODO.txt %license COPYING @@ -97,12 +124,16 @@ popd %{python3_sitearch}/%{pkgname} %{python3_sitearch}/_%{pkgname}.*.so %{python3_sitearch}/%{pkgname}_cffi_*.so +%endif %files doc %doc docs/_build/html/* %changelog +* Wed Jan 14 2015 Ralph Bean - 0.21.4-2 +- Conditionalize python3 subpackage. + * Mon Nov 17 2014 Mathieu Bridon - 0.21.4-1 - Update to 0.21.4