56fc4d
%if 0%{?fedora} > 12
56fc4d
%global with_python3 1
56fc4d
%else
56fc4d
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
56fc4d
%endif
56fc4d
56fc4d
# Enable building without docs to avoid a circular dependency between this
56fc4d
# and python-sphinx:
56fc4d
%global with_docs 1
56fc4d
a0650d
Name:           python-jinja2
a0650d
Version:        2.7.2
ce38be
Release:        4%{?dist}
a0650d
Summary:        General purpose template engine
a0650d
Group:          Development/Languages
a0650d
License:        BSD
a0650d
URL:            http://jinja.pocoo.org/
a0650d
Source0:        http://pypi.python.org/packages/source/J/Jinja2/Jinja2-%{version}.tar.gz
a19da0
a0650d
Patch1:         %{name}-align-jinjaext-with-compatibility-cleanups.patch
a19da0
a0650d
# Patch for CVE-2014-0012, see https://bugzilla.redhat.com/show_bug.cgi?id=1051421
a0650d
# for discussion (not yet sent upstream)
a0650d
Patch2:         python-jinja2-fix-CVE-2014-0012.patch
a19da0
ce38be
# Replace lambda for 'dict' with dict itself to support all dict constructors
ce38be
# Backported from Jinja2 2.8
ce38be
# https://github.com/pallets/jinja/commit/6179c02c91800d220de03006117afa5e6d60f0f6
ce38be
# https://bugzilla.redhat.com/show_bug.cgi?id=1697237
ce38be
Patch3:         python-jinja2-lambda-to-dict.patch
ce38be
a19da0
# Fix CVE-2016-10745
a19da0
# Also bundling the EscapeFormatter class from markupsafe >= 0.21, as we don't ship
a19da0
# that version in RHEL7 and it's required for the CVE fix
a19da0
# https://github.com/pallets/jinja/commit/9b53045c34e61013dc8f09b7e52a555fa16bed16
a19da0
# https://bugzilla.redhat.com/show_bug.cgi?id=1701309
a19da0
Patch4: python-jinja2-fix-CVE-2016-10745.patch
a19da0
a0650d
BuildArch:      noarch
a19da0
BuildRequires:  python2-devel
a19da0
BuildRequires:  python2-setuptools
a0650d
BuildRequires:  python-markupsafe
56fc4d
%if 0%{?with_docs}
a0650d
BuildRequires:  python-sphinx
56fc4d
%endif # with_docs
a0650d
Requires:       python-babel >= 0.8
a0650d
Requires:       python-markupsafe
56fc4d
%if 0%{?with_python3}
a0650d
BuildRequires:  python3-devel
a0650d
BuildRequires:  python3-setuptools
a0650d
BuildRequires:  python3-markupsafe
56fc4d
%endif # with_python3
56fc4d
a19da0
Provides: python2-jinja2 = %{version}-%{release}
56fc4d
56fc4d
%description
56fc4d
Jinja2 is a template engine written in pure Python.  It provides a
56fc4d
Django inspired non-XML syntax but supports inline expressions and an
56fc4d
optional sandboxed environment.
56fc4d
56fc4d
If you have any exposure to other text-based template languages, such
56fc4d
as Smarty or Django, you should feel right at home with Jinja2. It's
56fc4d
both designer and developer friendly by sticking to Python's
56fc4d
principles and adding functionality useful for templating
56fc4d
environments.
56fc4d
56fc4d
56fc4d
%if 0%{?with_python3}
56fc4d
%package -n python3-jinja2
a0650d
Summary:        General purpose template engine
a0650d
Group:          Development/Languages
a0650d
Requires:       python3-markupsafe
56fc4d
# babel isn't py3k ready yet, and is only a weak dependency
a0650d
#Requires:       python3-babel >= 0.8
56fc4d
56fc4d
56fc4d
%description -n python3-jinja2
56fc4d
Jinja2 is a template engine written in pure Python.  It provides a
56fc4d
Django inspired non-XML syntax but supports inline expressions and an
56fc4d
optional sandboxed environment.
56fc4d
56fc4d
If you have any exposure to other text-based template languages, such
56fc4d
as Smarty or Django, you should feel right at home with Jinja2. It's
56fc4d
both designer and developer friendly by sticking to Python's
56fc4d
principles and adding functionality useful for templating
56fc4d
environments.
56fc4d
%endif # with_python3
56fc4d
56fc4d
56fc4d
%prep
56fc4d
%setup -q -n Jinja2-%{version}
a0650d
%patch1 -p1
a0650d
%patch2 -p1
ce38be
%patch3 -p1
a19da0
%patch4 -p1
56fc4d
56fc4d
# cleanup
56fc4d
find . -name '*.pyo' -o -name '*.pyc' -delete
56fc4d
56fc4d
# fix EOL
56fc4d
sed -i 's|\r$||g' LICENSE
56fc4d
56fc4d
%if 0%{?with_python3}
56fc4d
cp -a . %{py3dir}
56fc4d
%endif # with_python3
56fc4d
56fc4d
56fc4d
%build
a19da0
%py2_build
56fc4d
56fc4d
# for now, we build docs using Python 2.x and use that for both
56fc4d
# packages.
56fc4d
%if 0%{?with_docs}
a0650d
make -C docs html PYTHONPATH=$(pwd)
56fc4d
%endif # with_docs
56fc4d
56fc4d
%if 0%{?with_python3}
56fc4d
pushd %{py3dir}
56fc4d
%{__python3} setup.py build
56fc4d
popd
56fc4d
%endif # with_python3
56fc4d
56fc4d
56fc4d
%install
a19da0
%py2_install
56fc4d
56fc4d
# remove hidden file
56fc4d
rm -rf docs/_build/html/.buildinfo
56fc4d
56fc4d
%if 0%{?with_python3}
56fc4d
pushd %{py3dir}
56fc4d
%{__python3} setup.py install -O1 --skip-build \
a0650d
        --root %{buildroot}
56fc4d
popd
56fc4d
%endif # with_python3
56fc4d
56fc4d
56fc4d
%check
56fc4d
make test
56fc4d
56fc4d
56fc4d
%if 0%{?with_python3}
56fc4d
pushd %{py3dir}
56fc4d
make test
56fc4d
popd
56fc4d
%endif # with_python3
56fc4d
56fc4d
56fc4d
%files
a19da0
%doc AUTHORS CHANGES
a19da0
%license LICENSE
56fc4d
%if 0%{?with_docs}
56fc4d
%doc docs/_build/html
56fc4d
%endif # with_docs
56fc4d
%doc ext
56fc4d
%doc examples
a19da0
%{python2_sitelib}/*
a19da0
%exclude %{python2_sitelib}/jinja2/_debugsupport.c
56fc4d
56fc4d
56fc4d
%if 0%{?with_python3}
56fc4d
%files -n python3-jinja2
56fc4d
%doc AUTHORS CHANGES LICENSE
56fc4d
%if 0%{?with_docs}
56fc4d
%doc docs/_build/html
56fc4d
%endif # with_docs
56fc4d
%doc ext
56fc4d
%doc examples
56fc4d
%{python3_sitelib}/*
56fc4d
%exclude %{python3_sitelib}/jinja2/_debugsupport.c
56fc4d
%endif # with_python3
56fc4d
56fc4d
56fc4d
%changelog
ce38be
* Thu May 02 2019 Charalampos Stratakis <cstratak@redhat.com> - 2.7.2-4
a19da0
- Fix for CVE-2016-10745
ce38be
Resolves: rhbz#1701309
ce38be
ce38be
* Wed Apr 10 2019 Miro Hrončok <mhroncok@redhat.com> - 2.7.2-3
ce38be
- Replace lambda for 'dict' with dict itself to support all dict constructors
ce38be
Resolves: rhbz#1697237
a19da0
a0650d
* Tue Jan 28 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 2.7.2-2
a0650d
- Fix CVE-2014-0012.
a0650d
Resolves: rhbz#1051427
a0650d
a0650d
* Wed Jan 15 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 2.7.2-1
a0650d
- Reverted flawed patch for #1051427 (this reintroduces #1052102).
a0650d
- Spec cleanup (removed rhel < 7 specific stuff).
a0650d
- Update to 2.7.2.
a0650d
Resolves: rhbz#1052777
a0650d
a0650d
* Tue Jan 14 2014 Tomas Radej <tradej@redhat.com> - 2.6-8
a0650d
- Using secure tmp dir
a0650d
- Replaced tabs with spaces
a0650d
Resolves: rhbz#1051427
a0650d
a0650d
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 2.6-7
a0650d
- Mass rebuild 2013-12-27
a0650d
56fc4d
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.6-6
56fc4d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
56fc4d
56fc4d
* Sat Aug 04 2012 David Malcolm <dmalcolm@redhat.com> - 2.6-5
56fc4d
- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3
56fc4d
56fc4d
* Fri Aug  3 2012 David Malcolm <dmalcolm@redhat.com> - 2.6-4
56fc4d
- remove rhel logic from with_python3 conditional
56fc4d
56fc4d
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.6-3
56fc4d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
56fc4d
56fc4d
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.6-2
56fc4d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
56fc4d
56fc4d
* Mon Jul 25 2011 Thomas Moschny <thomas.moschny@gmx.de> - 2.6-1
56fc4d
- Update to 2.6.
56fc4d
56fc4d
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.5.5-4
56fc4d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
56fc4d
56fc4d
* Tue Jan 18 2011 Thomas Moschny <thomas.moschny@gmx.de> - 2.5.5-3
56fc4d
- Re-enable html doc generation.
56fc4d
- Remove conditional for F-12 and below.
56fc4d
- Do not silently fail the testsuite for with py3k.
56fc4d
56fc4d
* Mon Nov  1 2010 Michel Salim <salimma@fedoraproject.org> - 2.5.5-2
56fc4d
- Move python3 runtime requirements to python3 subpackage
56fc4d
56fc4d
* Wed Oct 27 2010 Thomas Moschny <thomas.moschny@gmx.de> - 2.5.5-1
56fc4d
- Update to 2.5.5.
56fc4d
56fc4d
* Wed Aug 25 2010 Thomas Moschny <thomas.moschny@gmx.de> - 2.5.2-4
56fc4d
- Revert to previous behavior: fail the build on failed test.
56fc4d
- Rebuild for Python 3.2.
56fc4d
56fc4d
* Wed Aug 25 2010 Dan Horák <dan[at]danny.cz> - 2.5.2-3
56fc4d
- %%ifnarch doesn't work on noarch package so don't fail the build on failed tests
56fc4d
56fc4d
* Wed Aug 25 2010 Dan Horák <dan[at]danny.cz> - 2.5.2-2
56fc4d
- disable the testsuite on s390(x)
56fc4d
56fc4d
* Thu Aug 19 2010 Thomas Moschny <thomas.moschny@gmx.de> - 2.5.2-1
56fc4d
- Update to upstream version 2.5.2.
56fc4d
- Package depends on python-markupsafe and is noarch now.
56fc4d
56fc4d
* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 2.5-4
56fc4d
- add explicit build-requirement on python-setuptools
56fc4d
- fix doc disablement for python3 subpackage
56fc4d
56fc4d
* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 2.5-3
56fc4d
- support disabling documentation in the build to break a circular build-time
56fc4d
dependency with python-sphinx; disable docs for now
56fc4d
56fc4d
* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 2.5-2
56fc4d
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
56fc4d
56fc4d
* Tue Jul 13 2010 Thomas Moschny <thomas.moschny@gmx.de> - 2.5-1
56fc4d
- Update to upstream version 2.5.
a0650d
- Create python3 subpackage.
56fc4d
- Minor specfile fixes.
56fc4d
- Add examples directory.
56fc4d
- Thanks to Gareth Armstrong for additional hints.
56fc4d
56fc4d
* Wed Apr 21 2010 Thomas Moschny <thomas.moschny@gmx.de> - 2.4.1-1
56fc4d
- Update to 2.4.1.
56fc4d
56fc4d
* Tue Apr 13 2010 Thomas Moschny <thomas.moschny@gmx.de> - 2.4-1
56fc4d
- Update to 2.4.
56fc4d
56fc4d
* Tue Feb 23 2010 Thomas Moschny <thomas.moschny@gmx.de> - 2.3.1-1
56fc4d
- Update to 2.3.1.
56fc4d
- Docs are built using Sphinx now.
56fc4d
- Run the testsuite.
56fc4d
56fc4d
* Sat Sep 19 2009 Thomas Moschny <thomas.moschny@gmx.de> - 2.2.1-1
56fc4d
- Update to 2.2.1, mainly a bugfix release.
56fc4d
- Remove patch no longer needed.
56fc4d
- Remove conditional for FC-8.
56fc4d
- Compilation of speedup module has to be explicitly requested now.
56fc4d
56fc4d
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.1-3
56fc4d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
56fc4d
56fc4d
* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.1-2
56fc4d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
56fc4d
56fc4d
* Sat Jan 10 2009 Thomas Moschny <thomas.moschny@gmx.de> - 2.1.1-1
56fc4d
- Update to 2.1.1 (bugfix release).
56fc4d
56fc4d
* Thu Dec 18 2008 Thomas Moschny <thomas.moschny@gmx.de> - 2.1-1
56fc4d
- Update to 2.1, which fixes a number of bugs.
56fc4d
  See http://jinja.pocoo.org/2/documentation/changelog#version-2-1.
56fc4d
56fc4d
* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 2.0-3
56fc4d
- Rebuild for Python 2.6
56fc4d
56fc4d
* Tue Jul 22 2008 Thomas Moschny <thomas.moschny@gmx.de> - 2.0-2
56fc4d
- Use rpm buildroot macro instead of RPM_BUILD_ROOT.
56fc4d
56fc4d
* Sun Jul 20 2008 Thomas Moschny <thomas.moschny@gmx.de> - 2.0-1
56fc4d
- Upstream released 2.0.
56fc4d
56fc4d
* Sun Jun 29 2008 Thomas Moschny <thomas.moschny@gmx.de> - 2.0-0.1.rc1
56fc4d
- Modified specfile from the existing python-jinja package.