From 1ad67ab31dd171794fad00db56480be62b908632 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Thu, 16 Nov 2017 01:49:34 +0100 Subject: [PATCH] Update to 2.10. Use %bcond. Move BRs to their respective subpackages. --- python-jinja2.spec | 181 +++++++++++++++++++++++++++------------------ sources | 2 +- 2 files changed, 112 insertions(+), 71 deletions(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 40c4138..332978f 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,39 +1,31 @@ -%if 0%{?fedora} || 0%{?rhel} > 7 -%global with_python3 1 -%endif - -# Enable building without docs to avoid a circular dependency between this -# and python-sphinx: -%global with_docs 1 - -%if 0%{?fedora} > 25 || 0%{?rhel} > 7 -%global with_async 1 -%endif - Name: python-jinja2 -Version: 2.9.6 -Release: 4%{?dist} +Version: 2.10 +Release: 1%{?dist} Summary: General purpose template engine Group: Development/Languages License: BSD URL: http://jinja.pocoo.org/ Source0: https://files.pythonhosted.org/packages/source/J/Jinja2/Jinja2-%{version}.tar.gz -BuildArch: noarch -BuildRequires: python2-devel -BuildRequires: python2-setuptools -BuildRequires: python-markupsafe -BuildRequires: python2-pytest -%if 0%{?with_docs} -BuildRequires: python-sphinx -%endif # with_docs -%if 0%{?with_python3} -BuildRequires: python3-devel -BuildRequires: python3-setuptools -BuildRequires: python3-markupsafe -#BuildRequires: python3-pytest -%endif # with_python3 +%bcond_without python2 +%if 0%{?fedora} || 0%{?rhel} > 7 +%bcond_without python3 +%else +%bcond_with python3 +%endif + +# Enable building without docs to avoid a circular dependency between this +# and python-sphinx: +%bcond_without docs + +%if 0%{?fedora} > 25 || 0%{?rhel} > 7 +%bcond_without async +%else +%bcond_with async +%endif + +BuildArch: noarch %description Jinja2 is a template engine written in pure Python. It provides a @@ -47,11 +39,19 @@ principles and adding functionality useful for templating environments. +%if %{with python2} %package -n python2-jinja2 Summary: General purpose template engine for python2 -Group: Development/Languages +BuildRequires: python2-devel +BuildRequires: python2-setuptools +BuildRequires: python2-babel >= 0.8 +BuildRequires: python2-markupsafe +BuildRequires: python2-pytest +%if %{with docs} +BuildRequires: %{_bindir}/sphinx-build-2 +%endif Requires: python2-babel >= 0.8 -Requires: python-markupsafe +Requires: python2-markupsafe Requires: python2-setuptools %{?python_provide:%python_provide python2-jinja2} @@ -65,15 +65,24 @@ as Smarty or Django, you should feel right at home with Jinja2. It's both designer and developer friendly by sticking to Python's principles and adding functionality useful for templating environments. +%endif # with python2 -%if 0%{?with_python3} + +%if %{with python3} %package -n python3-jinja2 Summary: General purpose template engine for python3 Group: Development/Languages +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-babel >= 0.8 +BuildRequires: python3-markupsafe +BuildRequires: python3-pytest +%if %{with docs} +BuildRequires: %{_bindir}/sphinx-build-3 +%endif +Requires: python3-babel >= 0.8 Requires: python3-markupsafe Requires: python3-setuptools -# babel isn't py3k ready yet, and is only a weak dependency -#Requires: python3-babel >= 0.8 %{?python_provide:%python_provide python3-jinja2} %description -n python3-jinja2 @@ -86,94 +95,126 @@ as Smarty or Django, you should feel right at home with Jinja2. It's both designer and developer friendly by sticking to Python's principles and adding functionality useful for templating environments. -%endif # with_python3 +%endif # with python3 %prep -%setup -q -n Jinja2-%{version} +%setup -qc -n Jinja2-%{version} # cleanup -find . -name '*.pyo' -o -name '*.pyc' -delete +find Jinja2-%{version} -name '*.pyo' -o -name '*.pyc' -delete # fix EOL -sed -i 's|\r$||g' LICENSE +sed -i 's|\r$||g' Jinja2-%{version}/LICENSE + +mv Jinja2-%{version} python2 +cp -av python2 python3 %build +%if %{with python2} +pushd python2 %py2_build -# for now, we build docs using Python 2.x and use that for both -# packages. -%if 0%{?with_docs} -make -C docs html PYTHONPATH=$(pwd) -%endif # with_docs +%if %{with docs} +make -C docs html PYTHONPATH=$(pwd) SPHINXBUILD=sphinx-build-2 +%endif # with docs +popd +%endif # with python2 %if 0%{?with_python3} +pushd python3 %py3_build -%endif # with_python3 +%if %{with docs} +make -C docs html PYTHONPATH=$(pwd) SPHINXBUILD=sphinx-build-3 +%endif # with docs +popd +%endif # with python3 %install +%if %{with python2} +pushd python2 %py2_install # remove hidden file rm -rf docs/_build/html/.buildinfo +%if ! %{with async} # these files are valid only on Python 3.6+ rm %{buildroot}%{python2_sitelib}/jinja2/asyncsupport.py rm %{buildroot}%{python2_sitelib}/jinja2/asyncfilters.py +%endif # ! with async +popd +%endif # with python2 -%if 0%{?with_python3} +%if %{with python3} +pushd python3 %py3_install -%if ! 0%{?with_async} +# remove hidden file +rm -rf docs/_build/html/.buildinfo + +%if ! %{with async} +# these files are valid only on Python 3.6+ rm %{buildroot}%{python3_sitelib}/jinja2/asyncsupport.py rm %{buildroot}%{python3_sitelib}/jinja2/asyncfilters.py -%endif -%endif # with_python3 +%endif # ! with async +popd +%endif # with python3 %check +%if %{with python2} +pushd python2 # there are currently no tests in the jinja2 tarball # make test +popd +%endif # with python2 -%if 0%{?with_python3} +%if %{with python3} +pushd python3 # there are currently no tests in the jinja2 tarball # make test -%endif # with_python3 +popd +%endif # with python3 +%if %{with python2} %files -n python2-jinja2 -%doc AUTHORS -%doc CHANGES -%license LICENSE -%if 0%{?with_docs} -%doc docs/_build/html -%endif # with_docs -%doc ext -%doc examples +%doc python2/AUTHORS +%doc python2/CHANGES.rst +%doc python2/ext +%doc python2/examples +%license python2/LICENSE +%if %{with docs} +%doc python2/docs/_build/html +%endif %{python2_sitelib}/jinja2 %{python2_sitelib}/Jinja2-%{version}-py?.?.egg-info -%exclude %{python2_sitelib}/jinja2/_debugsupport.c +%endif # with python2 -%if 0%{?with_python3} +%if %{with python3} %files -n python3-jinja2 -%doc AUTHORS -%doc CHANGES -%license LICENSE -%if 0%{?with_docs} -# docs are built with python2 -%doc docs/_build/html -%endif # with_docs -%doc ext -%doc examples +%doc python3/AUTHORS +%doc python3/CHANGES.rst +%doc python3/ext +%doc python3/examples +%license python3/LICENSE +%if %{with docs} +%doc python3/docs/_build/html +%endif %{python3_sitelib}/jinja2 %{python3_sitelib}/Jinja2-%{version}-py?.?.egg-info -%exclude %{python3_sitelib}/jinja2/_debugsupport.c -%endif # with_python3 +%endif # with python3 %changelog +* Thu Nov 16 2017 Thomas Moschny - 2.10-1 +- Update to 2.10. +- Use %%bcond. +- Move BRs to their respective subpackages. + * Fri Oct 20 2017 Troy Dawson - 2.9.6-4 - Really cleanup spec file conditionals diff --git a/sources b/sources index 3d05ce5..e96d5fb 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (Jinja2-2.9.6.tar.gz) = b41b4e83bfe1ed2c5170e78bc6fb1ac3abb73df1b360c28e8011d430c3369efb49b923ede1f32c84c47c4bfa8a030ed24fc86700f2a8f777d54ee09c0fdee3c2 +SHA512 (Jinja2-2.10.tar.gz) = 0ea7371be67ffcf19e46dfd06523a45a0806e678a407d54f5f2f3e573982f0959cf82ec5d07b203670309928a62ef71109701ab16547a9bba2ebcdc178cb67f2