Conditionalize the Python 2 subpackage
This makes it possible to build without python2 support by passing "--without python2" to rpmbuild
This commit is contained in:
parent
d0221b8af2
commit
654d113cc8
@ -2,6 +2,12 @@
|
||||
%global with_python3 1
|
||||
%endif
|
||||
|
||||
%if 0%{?rhel} > 7
|
||||
%bcond_with python2
|
||||
%else
|
||||
%bcond_without python2
|
||||
%endif
|
||||
|
||||
%global upname Mako
|
||||
|
||||
Name: python-mako
|
||||
@ -17,6 +23,7 @@ Summary: Mako template library for Python
|
||||
URL: http://www.makotemplates.org/
|
||||
Source0: https://bitbucket.org/zzzeek/mako/get/rel_%(echo %{version} | sed "s/\./_/g").tar.bz2
|
||||
|
||||
%if %{with python2}
|
||||
BuildRequires: python2-devel
|
||||
BuildRequires: python2-pytest
|
||||
BuildRequires: python2-setuptools
|
||||
@ -24,6 +31,7 @@ BuildRequires: python2-markupsafe
|
||||
BuildRequires: python2-beaker
|
||||
BuildRequires: python2-nose
|
||||
BuildRequires: python2-mock
|
||||
%endif #{with python2}
|
||||
|
||||
%if 0%{?with_python3}
|
||||
BuildRequires: python3-devel
|
||||
@ -47,6 +55,7 @@ calling and scoping semantics.
|
||||
|
||||
%description %_description
|
||||
|
||||
%if %{with python2}
|
||||
%package -n python2-mako
|
||||
Summary: %summary
|
||||
Requires: python2-markupsafe
|
||||
@ -57,6 +66,7 @@ Recommends: python2-beaker
|
||||
%{?python_provide:%python_provide python2-mako}
|
||||
|
||||
%description -n python2-mako %_description
|
||||
%endif #{with python2}
|
||||
|
||||
%package doc
|
||||
Summary: Documentation for the Mako template library for Python
|
||||
@ -88,6 +98,10 @@ Recommends: python3-beaker
|
||||
|
||||
%{?python_provide:%python_provide python3-mako}
|
||||
|
||||
%if %{without python2}
|
||||
Obsoletes: python2-mako < %{version}-%{release}
|
||||
%endif
|
||||
|
||||
%description -n python3-mako
|
||||
Mako is a template library written in Python. It provides a familiar, non-XML
|
||||
syntax which compiles into Python modules for maximum performance. Mako's
|
||||
@ -110,7 +124,9 @@ cp -a . %{py3dir}
|
||||
%endif # with_python3
|
||||
|
||||
%build
|
||||
%if %{with python2}
|
||||
%{__python} setup.py build
|
||||
%endif %{with python2}
|
||||
|
||||
%if 0%{?with_python3}
|
||||
pushd %{py3dir}
|
||||
@ -125,17 +141,23 @@ rm -rf %{buildroot}
|
||||
%if 0%{?with_python3}
|
||||
pushd %{py3dir}
|
||||
%{__python3} setup.py install --skip-build --root %{buildroot}
|
||||
%if %{with python2}
|
||||
mv %{buildroot}/%{_bindir}/mako-render %{buildroot}/%{_bindir}/python3-mako-render
|
||||
%endif
|
||||
popd
|
||||
%endif # with_python3
|
||||
|
||||
%if %{with python2}
|
||||
%{__python} setup.py install --skip-build --root %{buildroot}
|
||||
%endif #{with python2}
|
||||
|
||||
# These are supporting files for building the docs. No need to ship
|
||||
rm -rf doc/build
|
||||
|
||||
%check
|
||||
%if %{with python2}
|
||||
python2 setup.py test
|
||||
%endif #{with python2}
|
||||
|
||||
%if 0%{?with_python3}
|
||||
pushd %{py3dir}
|
||||
@ -143,20 +165,25 @@ python3 setup.py test
|
||||
popd
|
||||
%endif
|
||||
|
||||
|
||||
%if %{with python2}
|
||||
%files -n python2-mako
|
||||
%defattr(-,root,root,-)
|
||||
%license LICENSE
|
||||
%doc CHANGES README.rst examples
|
||||
%{_bindir}/mako-render
|
||||
%{python_sitelib}/*
|
||||
%endif %{with python2}
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%files -n python3-mako
|
||||
%defattr(-,root,root,-)
|
||||
%license LICENSE
|
||||
%doc CHANGES README.rst examples
|
||||
%if %{with python2}
|
||||
%{_bindir}/python3-mako-render
|
||||
%else
|
||||
%{_bindir}/mako-render
|
||||
%endif
|
||||
%{python3_sitelib}/*
|
||||
%endif
|
||||
|
||||
@ -168,6 +195,7 @@ popd
|
||||
* Wed Mar 28 2018 Petr Viktorin <pviktori@redhat.com> - 1.0.6-9
|
||||
- Make python-beaker an optional dependency
|
||||
- Add missing python_provide for python3-mako
|
||||
- Conditionalize the Python 2 subpackage
|
||||
|
||||
* Mon Feb 12 2018 Iryna Shcherbina <ishcherb@redhat.com> - 1.0.6-8
|
||||
- Update Python 2 dependency declarations to new packaging standards
|
||||
|
Loading…
Reference in New Issue
Block a user