You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

303 lines
9.5 KiB

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