File python-svg2rlg.spec of Package python-svg2rlg

#
# spec file for package python-svg2rlg
#
# Copyright (c) 2021 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-%{**}}
Name:           python-svg2rlg
Version:        0.4.0
Release:        0
Summary:        A library for importing SVG into reportlab
License:        BSD-3-Clause
URL:            https://github.com/sarnold/svg2rlg
Source0:        https://github.com/sarnold/svg2rlg/archive/refs/tags/%{version}.tar.gz#/svg2rlg-%{version}.tar.gz
# PATCH-FIX-UPSTREAM svg2rlg-render_test.patch
Patch0:         svg2rlg-render_test.patch
BuildRequires:  %{python_module pytest}
BuildRequires:  %{python_module reportlab}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module wxPython}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch:      noarch
%python_subpackages

%description
svg2rlg is a python tool to convert SVG files to reportlab graphics.

The tool can be used as a console application to convert SVG to PDF files.

Known problems ( AKA todo list):

    Missing support for elliptical arcs in paths. It is belived to be possible
     to convert arcs to quadratic beziers.
    Text handling is limited.
    Style sheets not supported.

Note that some limitations are due to limitation in the reportlab graphics
 package:

    No gradients
    No text on path
    No filling rules (only odd-even)

A wxpython tool is included in the distribution which does a side by side
 comparison to the SVG test suite. Presently most of the official SVG 1.1 test
 suite is prefect.

%prep
%setup -q -n svg2rlg-%{version}
%autopatch -p1
sed -i -e '1{/^#!/d}' \
        svg2rlg.py

%build
%python_build

%install
%python_install
%python_clone -a %{buildroot}%{_bindir}/svg2rlg
%python_expand %fdupes %{buildroot}%{$python_sitelib}

%check
%pytest

%post
%python_install_alternative svg2rlg

%postun
%python_uninstall_alternative svg2rlg

%files %{python_files}
%license COPYING.txt
%doc README.md
%python_alternative %{_bindir}/svg2rlg
%{python_sitelib}/*

%changelog
openSUSE Build Service is sponsored by