%define pypi_name Jinja2 %bcond_with tests # jinja requires itself ( as python-sphinx use it ) to build doc %bcond_with doc Summary: Python template engine Name: python-jinja2 Version: 3.0.3 Release: %mkrel 2 License: BSD Group: Development/Python Url: https://jinja.palletsprojects.com/en/3.1.x/ Source0: %{pypi_source} BuildArch: noarch %description Jinja2 is a library for Python 2.4 and onwards that is designed to be flexible, fast and secure. 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. %package -n python3-jinja2 Summary: General purpose template engine Group: Development/Python BuildRequires: pkgconfig(python3) BuildRequires: python3dist(setuptools) BuildRequires: python3-markupsafe %if %{with tests} BuildRequires: python3dist(pytest) %endif %if %{with doc} BuildRequires: python3dist(sphinx) %endif %{?python_provide:%python_provide python3-jinja2} Requires: python3-markupsafe Requires: python3dist(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. %prep %setup -q -n %{pypi_name}-%{version} # drop bundled egg-info rm -rf src/*.egg-info perl -pi -e 's|\[pytest\]|[tool:pytest]|' setup.cfg # cleanup find . -name '*.pyo' -o -name '*.pyc' -delete %build %py3_build %if %{with doc} # doc build %make_build -C docs html PYTHONPATH=$(pwd) # clean leftovers %__rm -rf docs/_build/html/.buildinfo %endif %install %py3_install %files -n python3-jinja2 %license LICENSE.rst %doc README* CHANGES* %if %{with doc} %doc docs/_build/html %endif %doc examples %{python3_sitelib}/*