Fixup python3 conditionals

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
Igor Gnatenko 2017-11-20 14:10:21 +01:00
parent 5a5c48253a
commit d1eab5b68c

View File

@ -1,12 +1,14 @@
%if 0%{?fedora} %if 0%{?rhel} && 0%{?rhel} <= 7
%global with_python3 1 %bcond_with python3
%else
%bcond_without python3
%endif %endif
%global pkgname pygit2 %global pkgname pygit2
Name: python-%{pkgname} Name: python-%{pkgname}
Version: 0.26.1 Version: 0.26.1
Release: 2%{?dist} Release: 3%{?dist}
Summary: Python bindings for libgit2 Summary: Python bindings for libgit2
License: GPLv2 with linking exception License: GPLv2 with linking exception
@ -22,7 +24,6 @@ BuildRequires: openssl-devel
pygit2 is a set of Python bindings to the libgit2 library, which implements pygit2 is a set of Python bindings to the libgit2 library, which implements
the core of Git. the core of Git.
%package -n python2-%{pkgname} %package -n python2-%{pkgname}
Summary: Python 2.x bindings for libgit2 Summary: Python 2.x bindings for libgit2
%{?python_provide:%python_provide python2-%{pkgname}} %{?python_provide:%python_provide python2-%{pkgname}}
@ -40,8 +41,7 @@ the core of Git.
Python 2 version. Python 2 version.
%if %{with python3}
%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}}
@ -60,33 +60,27 @@ the core of Git.
Python 3 version. Python 3 version.
%endif %endif
%package doc %package doc
Summary: Documentation for %{name} Summary: Documentation for %{name}
BuildArch: noarch BuildArch: noarch
BuildRequires: python-sphinx BuildRequires: %{_bindir}/sphinx-build
%description doc %description doc
Documentation for %{name}. Documentation for %{name}.
%prep %prep
%autosetup -n %{pkgname}-%{version} -p1 %autosetup -n %{pkgname}-%{version} -p1
%build %build
%py2_build %py2_build
make -C docs html make -C docs html
%if %{with python3}
%if 0%{?with_python3}
%py3_build %py3_build
%endif %endif
%install %install
%py2_install %py2_install
%if %{with python3}
%if 0%{?with_python3}
%py3_install %py3_install
%endif %endif
@ -95,15 +89,12 @@ find %{_builddir} -name '.buildinfo' -delete
# Correct the permissions. # Correct the permissions.
find %{buildroot} -name '*.so' -exec chmod 755 {} ';' find %{buildroot} -name '*.so' -exec chmod 755 {} ';'
%check %check
%{__python2} setup.py test %{__python2} setup.py test
%if %{with python3}
%if 0%{?with_python3}
%{__python3} setup.py test %{__python3} setup.py test
%endif %endif
%files -n python2-%{pkgname} %files -n python2-%{pkgname}
%doc README.rst TODO.txt %doc README.rst TODO.txt
%license COPYING %license COPYING
@ -111,7 +102,7 @@ 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} %if %{with python3}
%files -n python3-%{pkgname} %files -n python3-%{pkgname}
%doc README.rst TODO.txt %doc README.rst TODO.txt
%license COPYING %license COPYING
@ -124,12 +115,14 @@ find %{buildroot} -name '*.so' -exec chmod 755 {} ';'
%license COPYING %license COPYING
%doc docs/_build/html/* %doc docs/_build/html/*
%changelog %changelog
* Mon Nov 20 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.26.1-3
- Fixup python3 conditionals
* Mon Nov 20 2017 Pete Walter <pwalter@fedoraproject.org> - 0.26.1-2 * Mon Nov 20 2017 Pete Walter <pwalter@fedoraproject.org> - 0.26.1-2
- Add back Python 3 conditionals - Add back Python 3 conditionals
* Mon Nov 20 2017 Pete Walter <pwalter@fedoraproject.org> - 0.26.1-1 * Mon Nov 20 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.26.1-1
- Update to 0.26.1 - Update to 0.26.1
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.26.0-3 * Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.26.0-3