File python3-Mako.spec of Package python3-Mako

#
# spec file for package python3-Mako
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define oldpython python
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name:           python3-Mako
Version:        1.0.7
Release:        0
Summary:        A Python templating language
License:        MIT
Group:          Development/Languages/Python
Url:            http://www.makotemplates.org/
Source:         https://pypi.io/packages/source/M/Mako/Mako-%{version}.tar.gz
# PATCH-FIX-UPSTREAM CVE-2022-40023-RE-DoS-Lexer.patch bsc#1203246 mcepl@suse.com
# fix tag regexp to match quoted groups correctly
Patch0:         CVE-2022-40023-RE-DoS-Lexer.patch
BuildRequires:  %{python_module MarkupSafe}
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module mock}
BuildRequires:  %{python_module pbr}
BuildRequires:  %{python_module pytest}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
Requires(post): update-alternatives
Requires(postun):update-alternatives
Requires:       python3-MarkupSafe
Recommends:     python3-Beaker >= 1.1
%ifpython2
Provides:       %{oldpython}-mako = %{version}
Obsoletes:      %{oldpython}-mako < %{version}
%endif
%ifpython3
Provides:       python3-mako = %{version}
Obsoletes:      python3-mako < %{version}
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%python_subpackages

%description
Mako is a template library written in Python. It provides a non-XML
syntax which compiles into Python modules for performance. Mako's
syntax and API borrows from Django templates, Cheetah, Myghty, and
Genshi. Conceptually, Mako is an embedded Python (i.e. Python Server
Page) language, which refines the ideas of componentized layout and
inheritance, while maintaining close ties to Python calling and
scoping semantics.

%prep
%autosetup -p1 -n Mako-%{version}
sed -i -e "s/\[pytest\]/\[tool:pytest\]/" setup.cfg

%build
%python_build

%install
%python_install
%python_clone -a %{buildroot}%{_bindir}/mako-render
%python_expand %fdupes -s %{buildroot}%{$python_sitelib}

%check
%python_exec setup.py test

%post
%python_install_alternative mako-render

%postun
%python_uninstall_alternative mako-render

%files %{python_files}
%defattr(-,root,root,-)
%license LICENSE
%doc CHANGES README.rst
%doc examples
%python_alternative %{_bindir}/mako-render
%{python_sitelib}/mako/
%{python_sitelib}/Mako-%{version}-py*.egg-info

%changelog
openSUSE Build Service is sponsored by