File python-reportlab.spec of Package python-reportlab.30899

#
# spec file for package python-reportlab
#
# Copyright (c) 2023 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 https://bugs.opensuse.org/
#


%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define oldpython python
%bcond_without tests
Name:           python-reportlab
Version:        3.4.0
Release:        0
Summary:        The Reportlab Toolkit
License:        BSD-3-Clause
Group:          Development/Languages/Python
URL:            https://www.reportlab.com/
Source:         https://files.pythonhosted.org/packages/source/r/reportlab/reportlab-%{version}.tar.gz
Patch0:         reportlab-missing-includes.patch
# PATCH-FIX-UPSTREAM drop unneeded requirements https://bitbucket.org/rptlab/reportlab/issues/113
Patch1:         drop-requirements.patch
# PATCH-FIX-UPSTREAM} make_toColor_safe.patch bsc#1154370 mcepl@suse.com
# make toColor function safer, CVE-2019-17626
Patch2:         make_toColor_safe.patch
# PATCH-FIX-UPSTREAM} CVE-2020-28463_fix_ssrf.patch bsc#1182503 danilo.spinella@suse.com
# fix SSRF in img tags, CVE-2020-28463
Patch3:         CVE-2020-28463_fix_ssrf.patch
# PATCH-FIX-UPSTREAM CVE-2023-33733-code-injection.patch bsc#1212065 mcepl@suse.com
# avoid code injection via a crafted PDF file
Patch4:         CVE-2023-33733-code-injection.patch
# PATCH-FIX-UPSTREAM CVE-2019-19450-code-inj-paraparser.patch bsc#1215560 mcepl@suse.com
# Patch from https://hg.reportlab.com/hg-public/reportlab/rev/b117091a73c2
# avoid code injection in paraparser.py allowing code execution
Patch5:         CVE-2019-19450-code-inj-paraparser.patch
BuildRequires:  %{python_module Pillow}
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module xml}
BuildRequires:  fdupes
BuildRequires:  freetype2-devel
BuildRequires:  python-rpm-macros
Requires:       python-Pillow
%ifpython2
Obsoletes:      %{oldpython}-ReportLab < %{version}
Provides:       %{oldpython}-ReportLab = %{version}
%endif
%ifpython3
Provides:       python3-ReportLab = %{version}
Obsoletes:      python3-ReportLab < %{version}
%endif
%python_subpackages

%description
The ReportLab Toolkit. An Open Source Python library for generating PDFs and graphics.

%prep
%autosetup -p1 -n reportlab-%{version}

sed -i "1d" src/reportlab/lib/{formatters,fonts,corp,units,pagesizes,__init__,randomtext,logger,normalDate}.py
sed -i "1d" src/reportlab/graphics/{widgets/table,barcode/test,testdrawings,testshapes}.py # Fix non-executable bits

%build
export CFLAGS="%{optflags}"
%python_build

%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitearch}

%if %{with tests}
%check
export LANG=en_US.UTF-8
%python_exec setup.py tests
%endif

%files %{python_files}
%license LICENSE.txt
%doc CHANGES.md README.txt
%{python_sitearch}/reportlab/
%{python_sitearch}/reportlab-%{version}-py*.egg-info

%changelog
openSUSE Build Service is sponsored by