7f6e73
%if 0%{?rhel} > 7
7f6e73
# Disable python2 build by default
7f6e73
%bcond_with python2
7f6e73
%else
7f6e73
%bcond_without python2
7f6e73
%endif
7f6e73
7f6e73
%if 0%{?fedora} || 0%{?rhel} > 7
7f6e73
%bcond_without python3
7f6e73
%else
7f6e73
%bcond_with python3
7f6e73
%endif
7f6e73
7f6e73
# Enable building without docs to avoid a circular dependency between this
7f6e73
# and python-sphinx:
7f6e73
%if %{with python3}
7f6e73
%bcond_without docs
7f6e73
%else
7f6e73
%bcond_with docs
7f6e73
%endif
7f6e73
7f6e73
%if 0%{?fedora} > 25 || 0%{?rhel} > 7
7f6e73
%bcond_without async
7f6e73
%else
7f6e73
%bcond_with async
7f6e73
%endif
7f6e73
7f6e73
Name:           python-jinja2
7f6e73
Version:        2.10.1
7f6e73
Release:        3%{?dist}
7f6e73
Summary:        General purpose template engine
7f6e73
Group:          Development/Languages
7f6e73
License:        BSD
7f6e73
URL:            http://jinja.pocoo.org/
7f6e73
Source0:        https://files.pythonhosted.org/packages/source/J/Jinja2/Jinja2-%{version}.tar.gz
7f6e73
7f6e73
# CVE-2020-28493: ReDOS vulnerability due to the sub-pattern
7f6e73
# The patch is rebased to the old project structure.
7f6e73
# Upstream commit: https://github.com/pallets/jinja/pull/1343/commits/ef658dc3b6389b091d608e710a810ce8b87995b3
7f6e73
# Tracking bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1928707
7f6e73
Patch0:         CVE-2020-28493.patch
7f6e73
7f6e73
BuildArch:      noarch
7f6e73
7f6e73
%description
7f6e73
Jinja2 is a template engine written in pure Python.  It provides a
7f6e73
Django inspired non-XML syntax but supports inline expressions and an
7f6e73
optional sandboxed environment.
7f6e73
7f6e73
If you have any exposure to other text-based template languages, such
7f6e73
as Smarty or Django, you should feel right at home with Jinja2. It's
7f6e73
both designer and developer friendly by sticking to Python's
7f6e73
principles and adding functionality useful for templating
7f6e73
environments.
7f6e73
7f6e73
7f6e73
%if %{with python2}
7f6e73
%package -n python2-jinja2
7f6e73
Summary:        General purpose template engine for python2
7f6e73
BuildRequires:  python2-devel
7f6e73
BuildRequires:  python2-setuptools
7f6e73
BuildRequires:  python2-markupsafe
7f6e73
BuildRequires:  python2-pytest
7f6e73
Requires:       python2-markupsafe
7f6e73
Requires:       python2-setuptools
7f6e73
%{?python_provide:%python_provide python2-jinja2}
7f6e73
7f6e73
%description -n python2-jinja2
7f6e73
Jinja2 is a template engine written in pure Python.  It provides a
7f6e73
Django inspired non-XML syntax but supports inline expressions and an
7f6e73
optional sandboxed environment.
7f6e73
7f6e73
If you have any exposure to other text-based template languages, such
7f6e73
as Smarty or Django, you should feel right at home with Jinja2. It's
7f6e73
both designer and developer friendly by sticking to Python's
7f6e73
principles and adding functionality useful for templating
7f6e73
environments.
7f6e73
%endif # with python2
7f6e73
7f6e73
7f6e73
%if %{with python3}
7f6e73
%package -n python3-jinja2
7f6e73
Summary:        General purpose template engine for python3
7f6e73
Group:          Development/Languages
7f6e73
BuildRequires:  python3-devel
7f6e73
BuildRequires:  python3-setuptools
7f6e73
BuildRequires:  python3-babel >= 0.8
7f6e73
BuildRequires:  python3-markupsafe
7f6e73
BuildRequires:  python3-pytest
7f6e73
%if %{with docs}
7f6e73
BuildRequires:  %{_bindir}/sphinx-build-3
7f6e73
%endif
7f6e73
Requires:       python3-babel >= 0.8
7f6e73
Requires:       python3-markupsafe
7f6e73
%if 0%{?rhel} && 0%{?rhel} >= 8
7f6e73
Requires:       platform-python-setuptools
7f6e73
%else
7f6e73
Requires:       python3-setuptools
7f6e73
%endif
7f6e73
%{?python_provide:%python_provide python3-jinja2}
7f6e73
7f6e73
%description -n python3-jinja2
7f6e73
Jinja2 is a template engine written in pure Python.  It provides a
7f6e73
Django inspired non-XML syntax but supports inline expressions and an
7f6e73
optional sandboxed environment.
7f6e73
7f6e73
If you have any exposure to other text-based template languages, such
7f6e73
as Smarty or Django, you should feel right at home with Jinja2. It's
7f6e73
both designer and developer friendly by sticking to Python's
7f6e73
principles and adding functionality useful for templating
7f6e73
environments.
7f6e73
%endif # with python3
7f6e73
7f6e73
7f6e73
%prep
7f6e73
%setup -qc -n Jinja2-%{version}
7f6e73
7f6e73
%patch0 -p1
7f6e73
7f6e73
# cleanup
7f6e73
find Jinja2-%{version} -name '*.pyo' -o -name '*.pyc' -delete
7f6e73
7f6e73
# fix EOL
7f6e73
sed -i 's|\r$||g' Jinja2-%{version}/LICENSE
7f6e73
7f6e73
mv Jinja2-%{version} python2
7f6e73
cp -av python2 python3
7f6e73
7f6e73
7f6e73
%build
7f6e73
%if %{with python2}
7f6e73
pushd python2
7f6e73
%py2_build
7f6e73
popd
7f6e73
%endif # with python2
7f6e73
7f6e73
%if %{with python3}
7f6e73
pushd python3
7f6e73
%py3_build
7f6e73
%if %{with docs}
7f6e73
make -C docs html PYTHONPATH=$(pwd) SPHINXBUILD=sphinx-build-3
7f6e73
%endif # with docs
7f6e73
popd
7f6e73
%endif # with python3
7f6e73
7f6e73
7f6e73
%install
7f6e73
%if %{with python2}
7f6e73
pushd python2
7f6e73
%py2_install
7f6e73
7f6e73
# these files are valid only on Python 3.6+
7f6e73
rm %{buildroot}%{python2_sitelib}/jinja2/asyncsupport.py
7f6e73
rm %{buildroot}%{python2_sitelib}/jinja2/asyncfilters.py
7f6e73
popd
7f6e73
%endif # with python2
7f6e73
7f6e73
%if %{with python3}
7f6e73
pushd python3
7f6e73
%py3_install
7f6e73
7f6e73
%if %{with docs}
7f6e73
# remove hidden file
7f6e73
rm -rf docs/_build/html/.buildinfo
7f6e73
%endif
7f6e73
7f6e73
%if ! %{with async}
7f6e73
# these files are valid only on Python 3.6+
7f6e73
rm %{buildroot}%{python3_sitelib}/jinja2/asyncsupport.py
7f6e73
rm %{buildroot}%{python3_sitelib}/jinja2/asyncfilters.py
7f6e73
%endif # ! with async
7f6e73
popd
7f6e73
%endif # with python3
7f6e73
7f6e73
7f6e73
%check
7f6e73
%if %{with python2}
7f6e73
pushd python2
7f6e73
# there are currently no tests in the jinja2 tarball
7f6e73
# make test
7f6e73
popd
7f6e73
%endif # with python2
7f6e73
7f6e73
%if %{with python3}
7f6e73
pushd python3
7f6e73
# there are currently no tests in the jinja2 tarball
7f6e73
# make test
7f6e73
popd
7f6e73
%endif # with python3
7f6e73
7f6e73
7f6e73
%if %{with python2}
7f6e73
%files -n python2-jinja2
7f6e73
%doc python2/AUTHORS
7f6e73
%doc python2/CHANGES.rst
7f6e73
%doc python2/ext
7f6e73
%doc python2/examples
7f6e73
%license python2/LICENSE
7f6e73
%{python2_sitelib}/jinja2
7f6e73
%{python2_sitelib}/Jinja2-%{version}-py?.?.egg-info
7f6e73
%endif # with python2
7f6e73
7f6e73
7f6e73
%if %{with python3}
7f6e73
%files -n python3-jinja2
7f6e73
%doc python3/AUTHORS
7f6e73
%doc python3/CHANGES.rst
7f6e73
%doc python3/ext
7f6e73
%doc python3/examples
7f6e73
%license python3/LICENSE
7f6e73
%if %{with docs}
7f6e73
%doc python3/docs/_build/html
7f6e73
%endif
7f6e73
%{python3_sitelib}/jinja2
7f6e73
%{python3_sitelib}/Jinja2-%{version}-py?.?.egg-info
7f6e73
%endif # with python3
7f6e73
7f6e73
7f6e73
%changelog
7f6e73
* Fri Mar 12 2021 Lumír Balhar <lbalhar@redhat.com> - 2.10.1-3
7f6e73
- Fix CVE-2020-28493: ReDOS vulnerability due to the sub-pattern
7f6e73
Resolves: rhbz#1928707
7f6e73
7f6e73
* Tue Apr 30 2019 Lumír Balhar <lbalhar@redhat.com> - 2.10.1-2
7f6e73
- Rebuild of package to go through gating
7f6e73
- Resolves: rhbz#1701301
7f6e73
7f6e73
* Thu Apr 25 2019 Lumír Balhar <lbalhar@redhat.com> - 2.10.1-1
7f6e73
- Rebase to 2.10.1 (security update) to fix CVE-2019-10906
7f6e73
- Resolves: rhbz#1701301
7f6e73
7f6e73
* Fri Nov 16 2018 Lumír Balhar <lbalhar@redhat.com> - 2.10-9
7f6e73
- Require platform-python-setuptools instead of python3-setuptools
7f6e73
- Resolves: rhbz#1650536
7f6e73
7f6e73
* Mon Aug 06 2018 Lumír Balhar <lbalhar@redhat.com> - 2.10-8
7f6e73
- Revert changes commited to wrong branch
7f6e73
7f6e73
* Sat Aug 04 2018 Lumír Balhar <lbalhar@redhat.com> - 2.10-7
7f6e73
- Fix conditions
7f6e73
7f6e73
* Sat Aug 04 2018 Lumír Balhar <lbalhar@redhat.com> - 2.10-6
7f6e73
- Specfile cleanup and fixes
7f6e73
7f6e73
* Mon Jun 25 2018 Lumír Balhar <Lbalhar@redhat.com> - 2.10-5
7f6e73
- Disable Python 2 build by default
7f6e73
7f6e73
* Mon Jun 25 2018 Lumír Balhar <Lbalhar@redhat.com> - 2.10-4
7f6e73
- Allow build with Python 2
7f6e73
7f6e73
* Mon May 28 2018 Petr Viktorin <pviktori@redhat.com> - 2.10-3
7f6e73
- Remove docs from Python 2 package
7f6e73
- Remove dependency on python2-babel and python2-sphinx
7f6e73
7f6e73
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.10-2
7f6e73
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
7f6e73
7f6e73
* Thu Nov 16 2017 Thomas Moschny <thomas.moschny@gmx.de> - 2.10-1
7f6e73
- Update to 2.10.
7f6e73
- Use %%bcond.
7f6e73
- Move BRs to their respective subpackages.
7f6e73
7f6e73
* Fri Oct 20 2017 Troy Dawson <tdawson@redhat.com> - 2.9.6-4
7f6e73
- Really cleanup spec file conditionals
7f6e73
7f6e73
* Fri Sep 29 2017 Troy Dawson <tdawson@redhat.com> - 2.9.6-3
7f6e73
- Cleanup spec file conditionals
7f6e73
7f6e73
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.9.6-2
7f6e73
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
7f6e73
7f6e73
* Wed Apr  5 2017 Thomas Moschny <thomas.moschny@gmx.de> - 2.9.6-1
7f6e73
- Update to 2.9.6.
7f6e73
7f6e73
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.9.5-2
7f6e73
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
7f6e73
7f6e73
* Sun Jan 29 2017 Thomas Moschny <thomas.moschny@gmx.de> - 2.9.5-1
7f6e73
- Update to 2.9.5.
7f6e73
7f6e73
* Fri Jan 13 2017 Thomas Moschny <thomas.moschny@gmx.de> - 2.9.4-1
7f6e73
- Update to 2.9.4.
7f6e73
7f6e73
* Sat Dec 31 2016 Thomas Moschny <thomas.moschny@gmx.de> - 2.8.1-1
7f6e73
- Update to 2.8.1.
7f6e73
7f6e73
* Fri Dec 09 2016 Charalampos Stratakis <cstratak@redhat.com> - 2.8-8
7f6e73
- Rebuild for Python 3.6
7f6e73
7f6e73
* Thu Sep 22 2016 Orion Poplawski <orion@cora.nwra.com> - 2.8-7
7f6e73
- Ship python2-jinja2 (bug #1378519)
7f6e73
- Modernize spec
7f6e73
7f6e73
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.8-6
7f6e73
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
7f6e73
7f6e73
* Fri Feb  5 2016 Thomas Moschny <thomas.moschny@gmx.de> - 2.8-5
7f6e73
- Do not call py.test, there are currently no tests in the tarball.
7f6e73
7f6e73
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.8-4
7f6e73
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
7f6e73
7f6e73
* Mon Oct 12 2015 Robert Kuska <rkuska@redhat.com> - 2.8-3
7f6e73
- Rebuilt for Python3.5 rebuild
7f6e73
7f6e73
* Mon Jul 27 2015 Thomas Moschny <thomas.moschny@gmx.de> - 2.8-2
7f6e73
- Apply updates Python packaging guidelines.
7f6e73
- Mark LICENSE with %%license.
7f6e73
7f6e73
* Sun Jul 26 2015 Haïkel Guémar <hguemar@fedoraproject.org> - 2.8-1
7f6e73
- Upstream 2.8
7f6e73
7f6e73
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.7.3-3
7f6e73
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
7f6e73
7f6e73
* Tue Dec 2 2014 Orion Poplawski <orion@cora.nwra.com> - 2.7.3-2
7f6e73
- Add Requires python(3)-setuptools (bug #1168774)
7f6e73
7f6e73
* Sat Jun  7 2014 Thomas Moschny <thomas.moschny@gmx.de> - 2.7.3-1
7f6e73
- Update to 2.7.3.
7f6e73
- Reenable docs.
7f6e73
7f6e73
* Sat May 10 2014 Orion Poplawski <orion@cora.nwra.com> - 2.7.2-2
7f6e73
- Bootstrap (without docs) build for Python 3.4
7f6e73
7f6e73
* Fri Jan 10 2014 Thomas Moschny <thomas.moschny@gmx.de> - 2.7.2-1
7f6e73
- Update to 2.7.2.
7f6e73
- Update python3 conditional.
7f6e73
7f6e73
* Fri Aug 16 2013 Thomas Moschny <thomas.moschny@gmx.de> - 2.7.1-1
7f6e73
- Update to 2.7.1.
7f6e73
7f6e73
* Thu Jul 25 2013 Orion Poplawski <orion@cora.nwra.com> - 2.7-1
7f6e73
- Update to 2.7
7f6e73
- spec cleanup
7f6e73
7f6e73
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.6-6
7f6e73
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
7f6e73
7f6e73
* Sat Aug 04 2012 David Malcolm <dmalcolm@redhat.com> - 2.6-5
7f6e73
- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3
7f6e73
7f6e73
* Fri Aug  3 2012 David Malcolm <dmalcolm@redhat.com> - 2.6-4
7f6e73
- remove rhel logic from with_python3 conditional
7f6e73
7f6e73
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.6-3
7f6e73
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
7f6e73
7f6e73
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.6-2
7f6e73
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
7f6e73
7f6e73
* Mon Jul 25 2011 Thomas Moschny <thomas.moschny@gmx.de> - 2.6-1
7f6e73
- Update to 2.6.
7f6e73
7f6e73
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.5.5-4
7f6e73
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
7f6e73
7f6e73
* Tue Jan 18 2011 Thomas Moschny <thomas.moschny@gmx.de> - 2.5.5-3
7f6e73
- Re-enable html doc generation.
7f6e73
- Remove conditional for F-12 and below.
7f6e73
- Do not silently fail the testsuite for with py3k.
7f6e73
7f6e73
* Mon Nov  1 2010 Michel Salim <salimma@fedoraproject.org> - 2.5.5-2
7f6e73
- Move python3 runtime requirements to python3 subpackage
7f6e73
7f6e73
* Wed Oct 27 2010 Thomas Moschny <thomas.moschny@gmx.de> - 2.5.5-1
7f6e73
- Update to 2.5.5.
7f6e73
7f6e73
* Wed Aug 25 2010 Thomas Moschny <thomas.moschny@gmx.de> - 2.5.2-4
7f6e73
- Revert to previous behavior: fail the build on failed test.
7f6e73
- Rebuild for Python 3.2.
7f6e73
7f6e73
* Wed Aug 25 2010 Dan Horák <dan[at]danny.cz> - 2.5.2-3
7f6e73
- %%ifnarch doesn't work on noarch package so don't fail the build on failed tests
7f6e73
7f6e73
* Wed Aug 25 2010 Dan Horák <dan[at]danny.cz> - 2.5.2-2
7f6e73
- disable the testsuite on s390(x)
7f6e73
7f6e73
* Thu Aug 19 2010 Thomas Moschny <thomas.moschny@gmx.de> - 2.5.2-1
7f6e73
- Update to upstream version 2.5.2.
7f6e73
- Package depends on python-markupsafe and is noarch now.
7f6e73
7f6e73
* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 2.5-4
7f6e73
- add explicit build-requirement on python-setuptools
7f6e73
- fix doc disablement for python3 subpackage
7f6e73
7f6e73
* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 2.5-3
7f6e73
- support disabling documentation in the build to break a circular build-time
7f6e73
dependency with python-sphinx; disable docs for now
7f6e73
7f6e73
* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 2.5-2
7f6e73
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
7f6e73
7f6e73
* Tue Jul 13 2010 Thomas Moschny <thomas.moschny@gmx.de> - 2.5-1
7f6e73
- Update to upstream version 2.5.
7f6e73
- Create python3 subpackage.
7f6e73
- Minor specfile fixes.
7f6e73
- Add examples directory.
7f6e73
- Thanks to Gareth Armstrong for additional hints.
7f6e73
7f6e73
* Wed Apr 21 2010 Thomas Moschny <thomas.moschny@gmx.de> - 2.4.1-1
7f6e73
- Update to 2.4.1.
7f6e73
7f6e73
* Tue Apr 13 2010 Thomas Moschny <thomas.moschny@gmx.de> - 2.4-1
7f6e73
- Update to 2.4.
7f6e73
7f6e73
* Tue Feb 23 2010 Thomas Moschny <thomas.moschny@gmx.de> - 2.3.1-1
7f6e73
- Update to 2.3.1.
7f6e73
- Docs are built using Sphinx now.
7f6e73
- Run the testsuite.
7f6e73
7f6e73
* Sat Sep 19 2009 Thomas Moschny <thomas.moschny@gmx.de> - 2.2.1-1
7f6e73
- Update to 2.2.1, mainly a bugfix release.
7f6e73
- Remove patch no longer needed.
7f6e73
- Remove conditional for FC-8.
7f6e73
- Compilation of speedup module has to be explicitly requested now.
7f6e73
7f6e73
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.1-3
7f6e73
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
7f6e73
7f6e73
* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.1-2
7f6e73
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
7f6e73
7f6e73
* Sat Jan 10 2009 Thomas Moschny <thomas.moschny@gmx.de> - 2.1.1-1
7f6e73
- Update to 2.1.1 (bugfix release).
7f6e73
7f6e73
* Thu Dec 18 2008 Thomas Moschny <thomas.moschny@gmx.de> - 2.1-1
7f6e73
- Update to 2.1, which fixes a number of bugs.
7f6e73
  See http://jinja.pocoo.org/2/documentation/changelog#version-2-1.
7f6e73
7f6e73
* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 2.0-3
7f6e73
- Rebuild for Python 2.6
7f6e73
7f6e73
* Tue Jul 22 2008 Thomas Moschny <thomas.moschny@gmx.de> - 2.0-2
7f6e73
- Use rpm buildroot macro instead of RPM_BUILD_ROOT.
7f6e73
7f6e73
* Sun Jul 20 2008 Thomas Moschny <thomas.moschny@gmx.de> - 2.0-1
7f6e73
- Upstream released 2.0.
7f6e73
7f6e73
* Sun Jun 29 2008 Thomas Moschny <thomas.moschny@gmx.de> - 2.0-0.1.rc1
7f6e73
- Modified specfile from the existing python-jinja package.