Update to 2.10.

Use %bcond.
Move BRs to their respective subpackages.
This commit is contained in:
Thomas Moschny 2017-11-16 01:49:34 +01:00
parent aca2e1769c
commit 1ad67ab31d
2 changed files with 112 additions and 71 deletions

View File

@ -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 Name: python-jinja2
Version: 2.9.6 Version: 2.10
Release: 4%{?dist} Release: 1%{?dist}
Summary: General purpose template engine Summary: General purpose template engine
Group: Development/Languages Group: Development/Languages
License: BSD License: BSD
URL: http://jinja.pocoo.org/ URL: http://jinja.pocoo.org/
Source0: https://files.pythonhosted.org/packages/source/J/Jinja2/Jinja2-%{version}.tar.gz Source0: https://files.pythonhosted.org/packages/source/J/Jinja2/Jinja2-%{version}.tar.gz
BuildArch: noarch %bcond_without python2
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
%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 %description
Jinja2 is a template engine written in pure Python. It provides a Jinja2 is a template engine written in pure Python. It provides a
@ -47,11 +39,19 @@ principles and adding functionality useful for templating
environments. environments.
%if %{with python2}
%package -n python2-jinja2 %package -n python2-jinja2
Summary: General purpose template engine for python2 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: python2-babel >= 0.8
Requires: python-markupsafe Requires: python2-markupsafe
Requires: python2-setuptools Requires: python2-setuptools
%{?python_provide:%python_provide python2-jinja2} %{?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 both designer and developer friendly by sticking to Python's
principles and adding functionality useful for templating principles and adding functionality useful for templating
environments. environments.
%endif # with python2
%if 0%{?with_python3}
%if %{with python3}
%package -n python3-jinja2 %package -n python3-jinja2
Summary: General purpose template engine for python3 Summary: General purpose template engine for python3
Group: Development/Languages 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-markupsafe
Requires: python3-setuptools 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} %{?python_provide:%python_provide python3-jinja2}
%description -n 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 both designer and developer friendly by sticking to Python's
principles and adding functionality useful for templating principles and adding functionality useful for templating
environments. environments.
%endif # with_python3 %endif # with python3
%prep %prep
%setup -q -n Jinja2-%{version} %setup -qc -n Jinja2-%{version}
# cleanup # cleanup
find . -name '*.pyo' -o -name '*.pyc' -delete find Jinja2-%{version} -name '*.pyo' -o -name '*.pyc' -delete
# fix EOL # 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 %build
%if %{with python2}
pushd python2
%py2_build %py2_build
# for now, we build docs using Python 2.x and use that for both %if %{with docs}
# packages. make -C docs html PYTHONPATH=$(pwd) SPHINXBUILD=sphinx-build-2
%if 0%{?with_docs} %endif # with docs
make -C docs html PYTHONPATH=$(pwd) popd
%endif # with_docs %endif # with python2
%if 0%{?with_python3} %if 0%{?with_python3}
pushd python3
%py3_build %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 %install
%if %{with python2}
pushd python2
%py2_install %py2_install
# remove hidden file # remove hidden file
rm -rf docs/_build/html/.buildinfo rm -rf docs/_build/html/.buildinfo
%if ! %{with async}
# these files are valid only on Python 3.6+ # these files are valid only on Python 3.6+
rm %{buildroot}%{python2_sitelib}/jinja2/asyncsupport.py rm %{buildroot}%{python2_sitelib}/jinja2/asyncsupport.py
rm %{buildroot}%{python2_sitelib}/jinja2/asyncfilters.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 %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/asyncsupport.py
rm %{buildroot}%{python3_sitelib}/jinja2/asyncfilters.py rm %{buildroot}%{python3_sitelib}/jinja2/asyncfilters.py
%endif %endif # ! with async
%endif # with_python3 popd
%endif # with python3
%check %check
%if %{with python2}
pushd python2
# there are currently no tests in the jinja2 tarball # there are currently no tests in the jinja2 tarball
# make test # make test
popd
%endif # with python2
%if 0%{?with_python3} %if %{with python3}
pushd python3
# there are currently no tests in the jinja2 tarball # there are currently no tests in the jinja2 tarball
# make test # make test
%endif # with_python3 popd
%endif # with python3
%if %{with python2}
%files -n python2-jinja2 %files -n python2-jinja2
%doc AUTHORS %doc python2/AUTHORS
%doc CHANGES %doc python2/CHANGES.rst
%license LICENSE %doc python2/ext
%if 0%{?with_docs} %doc python2/examples
%doc docs/_build/html %license python2/LICENSE
%endif # with_docs %if %{with docs}
%doc ext %doc python2/docs/_build/html
%doc examples %endif
%{python2_sitelib}/jinja2 %{python2_sitelib}/jinja2
%{python2_sitelib}/Jinja2-%{version}-py?.?.egg-info %{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 %files -n python3-jinja2
%doc AUTHORS %doc python3/AUTHORS
%doc CHANGES %doc python3/CHANGES.rst
%license LICENSE %doc python3/ext
%if 0%{?with_docs} %doc python3/examples
# docs are built with python2 %license python3/LICENSE
%doc docs/_build/html %if %{with docs}
%endif # with_docs %doc python3/docs/_build/html
%doc ext %endif
%doc examples
%{python3_sitelib}/jinja2 %{python3_sitelib}/jinja2
%{python3_sitelib}/Jinja2-%{version}-py?.?.egg-info %{python3_sitelib}/Jinja2-%{version}-py?.?.egg-info
%exclude %{python3_sitelib}/jinja2/_debugsupport.c %endif # with python3
%endif # with_python3
%changelog %changelog
* Thu Nov 16 2017 Thomas Moschny <thomas.moschny@gmx.de> - 2.10-1
- Update to 2.10.
- Use %%bcond.
- Move BRs to their respective subpackages.
* Fri Oct 20 2017 Troy Dawson <tdawson@redhat.com> - 2.9.6-4 * Fri Oct 20 2017 Troy Dawson <tdawson@redhat.com> - 2.9.6-4
- Really cleanup spec file conditionals - Really cleanup spec file conditionals

View File

@ -1 +1 @@
SHA512 (Jinja2-2.9.6.tar.gz) = b41b4e83bfe1ed2c5170e78bc6fb1ac3abb73df1b360c28e8011d430c3369efb49b923ede1f32c84c47c4bfa8a030ed24fc86700f2a8f777d54ee09c0fdee3c2 SHA512 (Jinja2-2.10.tar.gz) = 0ea7371be67ffcf19e46dfd06523a45a0806e678a407d54f5f2f3e573982f0959cf82ec5d07b203670309928a62ef71109701ab16547a9bba2ebcdc178cb67f2