%{!?dotests: %define dotests 1} %define name python3-jinja2 %define srcname Jinja2 %define version 2.10.3 %define release 1 # Tests by default. No tests: rpm -ba --define 'dotests 0' *.spec %{!?dotests: %define dotests 1} # Needs care because default command python may be linked to 32 or 64 bit python # and compiler/loader options are not the same, e.g. -maix32/-maix64 # Also, although # /usr/bin/python_64 eventually links to /opt/freeware/bin/python2.7_64 # /usr/bin/python_32 links to inexistant /opt/freeware/bin/python2_32 # So, use /opt/freeware/bin/python2.7 and /opt/freeware/bin/python2.7_64 %define is_python %(test -e /opt/freeware/bin/python3_32 && echo 1 || echo 0) %if %{is_python} %define python_sitelib %(/opt/freeware/bin/python3_32 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))") %endif %define _libdir64 %{_prefix}/lib64 %define is_python_64 %(test -e /opt/freeware/bin/python3_64 && echo 1 || echo 0) %if %{is_python_64} %define python_sitelib64 %(/opt/freeware/bin/python3 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))") %endif %global with_python3 0 %global with_async 1 # Enable building without docs to avoid a circular dependency between this # and python-sphinx: %global with_docs 0 Name: %{name} Version: %{version} Release: %{release} Summary: General purpose template engine for python2 Group: Development/Languages License: BSD URL: http://jinja.pocoo.org/ Source0: https://files.pythonhosted.org/packages/source/J/Jinja2/Jinja2-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Prefix: %{_prefix} BuildArch: noarch BuildRequires: python3-devel #BuildRequires: python3-markupsafe #BuildRequires: python3-pytest #BuildRequires: python3-babel %if 0%{?with_docs} BuildRequires: python3-sphinx %endif # with_docs Requires: python3-markupsafe >= 1.1.1 Provides: python3-jinja2 %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. %prep %setup -q -n %{srcname}-%{version} echo "dotests=%{dotests}" # cleanup find . -name '*.pyo' -o -name '*.pyc' -exec rm {} \; # fix EOL sed -i 's|\r$||g' LICENSE.rst %build /opt/freeware/bin/python3 setup.py build if [ "%{dotests}" == 1 ] then python3 -m pytest tests fi %install [ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT /opt/freeware/bin/python3 setup.py install --skip-build --root ${RPM_BUILD_ROOT} # Remove hidden file rm -rf docs/_build/html/.buildinfo %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files -n python3-jinja2 %defattr(-,root,system,-) %doc CHANGES.rst %doc LICENSE.rst %if 0%{?with_docs} %doc html %endif # with_docs %doc ext %doc examples %{python_sitelib}/jinja2 %{python_sitelib}/Jinja2-%{version}-py?.?.egg-info %changelog * Thu Nov 14 2019 Baanu Tumma 2.10.3-1 - Update to latest version, built using python3 * Tue Jun 18 2019 Baanu Tumma - 2.10.1-1 - Update to 2.10.1 ( fixed CVE-2016-10745 CVE-2019-10906 ) * Wed May 24 2017 Michael Wilson - 2.9.6-1 - Update to 2.9.6 * Tue Jul 16 2013 Tristan Delhalle - 2.7-1 - - first version for AIX V6.1 and higher