From 7075de9982ccc6906a34b65ae509ab7972e273d1 Mon Sep 17 00:00:00 2001 From: Xavier Bachelot Date: Aug 13 2019 12:41:00 +0000 Subject: [PATCH 1/3] Conditionalize python2/python3 builds --- diff --git a/python-dulwich.spec b/python-dulwich.spec index 29ed3c9..3c9a698 100644 --- a/python-dulwich.spec +++ b/python-dulwich.spec @@ -4,6 +4,13 @@ %global __provides_exclude_from ^(%{python2_sitearch}/.*\\.so)$ %global __provides_exclude_from ^(%{python3_sitearch}/.*\\.so)$ +%if %{defined el6} || %{defined el7} || (0%{?fedora} && 0%{?fedora} < 31) +%bcond_without python2 +%endif + +%bcond_without python3 + + Name: python-%{srcname} Version: 0.19.11 Release: 3%{?dist} @@ -14,16 +21,7 @@ URL: https://www.dulwich.io/ Source0: %pypi_source dulwich BuildRequires: gcc -BuildRequires: python2-devel -BuildRequires: python3-devel -BuildRequires: python2-nose -BuildRequires: python2-docutils -BuildRequires: python3-sphinx -BuildRequires: python3-docutils -%if (0%{?rhel} && 0%{?rhel} < 7) || (0%{?fedora} && 0%{?fedora} < 14) -BuildRequires: python-unittest2 -%endif %description Dulwich is a pure-Python implementation of the Git file formats and @@ -36,8 +34,16 @@ Summary: Shared files for Dulwich %description -n %{srcname}-core Files to ensure functionality for both python2 and python3 packages of Dulwich. +%if %{with python2} %package -n python2-%{srcname} Summary: %{sum} +BuildRequires: python2-devel +BuildRequires: python2-docutils +BuildRequires: python2-nose +BuildRequires: python2-sphinx +%if (0%{?rhel} && 0%{?rhel} < 7) || (0%{?fedora} && 0%{?fedora} < 14) +BuildRequires: python-unittest2 +%endif %{?python_provide:%python_provide python2-%{srcname}} Requires: %{srcname}-core%{?_isa} = %{version}-%{release} @@ -45,9 +51,14 @@ Requires: %{srcname}-core%{?_isa} = %{version}-%{release} Dulwich is a pure-Python implementation of the Git file formats and protocols. The project is named after the village in which Mr. and Mrs. Git live in the Monty Python sketch. +%endif +%if %{with python3} %package -n python3-%{srcname} Summary: %{sum} +BuildRequires: python3-devel +BuildRequires: python3-docutils +BuildRequires: python3-sphinx %{?python_provide:%python_provide python3-%{srcname}} Requires: %{srcname}-core%{?_isa} = %{version}-%{release} @@ -55,6 +66,7 @@ Requires: %{srcname}-core%{?_isa} = %{version}-%{release} Dulwich is a pure-Python implementation of the Git file formats and protocols. The project is named after the village in which Mr. and Mrs. Git live in the Monty Python sketch. +%endif %prep %autosetup -n %{srcname}-%{version} @@ -63,22 +75,24 @@ Mrs. Git live in the Monty Python sketch. sed -i '/sphinx_epytext/d' docs/conf.py %build -%py2_build -%py3_build +%{?with_python2:%py2_build} +%{?with_python3:%py3_build} pushd docs # Not using {smp_flags} as sphinx fails with it from time to time make html rm -rf build/html/{.buildinfo,doctrees} +%if %{with python3} sphinx-build-3 -b html -d py3/doctrees . py3/html rm -rf py3/html/.buildinfo +%endif popd %install -%py2_install -%py3_install +%{?with_python2:%py2_install} +%{?with_python3:%py3_install} # Remove extra copy of text docs -rm -rf %{buildroot}%{python2_sitearch}/docs/tutorial/ -rm -rf %{buildroot}%{python3_sitearch}/docs/tutorial/ +%{?with_python2:rm -rf %{buildroot}%{python2_sitearch}/docs/tutorial/} +%{?with_python3:rm -rf %{buildroot}%{python3_sitearch}/docs/tutorial/} #%check # FIXME test_non_ascii fails cause of unicode issue @@ -90,15 +104,19 @@ rm -rf %{buildroot}%{python3_sitearch}/docs/tutorial/ %{_bindir}/dul-* %{_bindir}/%{srcname} +%if %{with python2} %files -n python2-%{srcname} %doc docs/build/html/ %{python2_sitearch}/%{srcname}* %exclude %{python2_sitearch}/%{srcname}/tests* +%endif +%if %{with python3} %files -n python3-%{srcname} %doc docs/py3/html/ %{python3_sitearch}/%{srcname}* %exclude %{python3_sitearch}/%{srcname}/tests* +%endif %changelog * Fri Jul 26 2019 Fedora Release Engineering - 0.19.11-3 From b7debb65b7a95e4ca23b252553278f0c49962e67 Mon Sep 17 00:00:00 2001 From: Xavier Bachelot Date: Aug 13 2019 12:43:34 +0000 Subject: [PATCH 2/3] Fix EL7 build --- diff --git a/python-dulwich.spec b/python-dulwich.spec index 3c9a698..02a5ca1 100644 --- a/python-dulwich.spec +++ b/python-dulwich.spec @@ -54,15 +54,15 @@ Mrs. Git live in the Monty Python sketch. %endif %if %{with python3} -%package -n python3-%{srcname} +%package -n python%{python3_pkgversion}-%{srcname} Summary: %{sum} -BuildRequires: python3-devel -BuildRequires: python3-docutils -BuildRequires: python3-sphinx -%{?python_provide:%python_provide python3-%{srcname}} +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-docutils +BuildRequires: python%{python3_pkgversion}-sphinx +%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}} Requires: %{srcname}-core%{?_isa} = %{version}-%{release} -%description -n python3-%{srcname} +%description -n python%{python3_pkgversion}-%{srcname} Dulwich is a pure-Python implementation of the Git file formats and protocols. The project is named after the village in which Mr. and Mrs. Git live in the Monty Python sketch. @@ -78,11 +78,14 @@ sed -i '/sphinx_epytext/d' docs/conf.py %{?with_python2:%py2_build} %{?with_python3:%py3_build} pushd docs +%if 0%{?el6}%{?el7} +sed -i -e 's,sphinx-apidoc -feM,sphinx-apidoc -f,' Makefile +%endif # Not using {smp_flags} as sphinx fails with it from time to time make html rm -rf build/html/{.buildinfo,doctrees} %if %{with python3} -sphinx-build-3 -b html -d py3/doctrees . py3/html +sphinx-build-%{python3_version} -b html -d py3/doctrees . py3/html rm -rf py3/html/.buildinfo %endif popd @@ -112,7 +115,7 @@ popd %endif %if %{with python3} -%files -n python3-%{srcname} +%files -n python%{python3_pkgversion}-%{srcname} %doc docs/py3/html/ %{python3_sitearch}/%{srcname}* %exclude %{python3_sitearch}/%{srcname}/tests* From 6c38606d1fcfc64dd11b83581246c6b6f35d4c52 Mon Sep 17 00:00:00 2001 From: Xavier Bachelot Date: Aug 13 2019 12:43:36 +0000 Subject: [PATCH 3/3] Add changelog entry --- diff --git a/python-dulwich.spec b/python-dulwich.spec index 02a5ca1..388c72b 100644 --- a/python-dulwich.spec +++ b/python-dulwich.spec @@ -13,7 +13,7 @@ Name: python-%{srcname} Version: 0.19.11 -Release: 3%{?dist} +Release: 4%{?dist} Summary: %{sum} License: GPLv2+ or ASL 2.0 @@ -122,6 +122,10 @@ popd %endif %changelog +* Tue Aug 13 2019 Xavier Bachelot - 0.19.11-4 +- Conditionalize python2/python3 builds. +- Fix build on EL7. + * Fri Jul 26 2019 Fedora Release Engineering - 0.19.11-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild