File python-rst2pdf.spec of Package python-rst2pdf

#
# spec file for package python-rst2pdf
#
# 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/
#

%define skip_python2 1
Name:           python-rst2pdf
Version:        0.98
Release:        0
Summary:        Tool for transforming reStructuredText to PDF using ReportLab
License:        MIT
Group:          Development/Libraries/Python
URL:            https://rst2pdf.org/
Source:         https://github.com/rst2pdf/rst2pdf/archive/refs/tags/%{version}.tar.gz#/rst2pdf-%{version}.tar.gz
BuildRequires:  fdupes
# TEST
BuildRequires:  %{python_module PyMuPDF}
###
BuildRequires: %{python_module PyPDF2}
###
BuildRequires:  %{python_module Sphinx}
BuildRequires:  %{python_module pytest}
BuildRequires:  %{python_module reportlab}
BuildRequires:  %{python_module smartypants}
# /TEST
BuildRequires:  %{python_module setuptools}
BuildRequires:  python-rpm-macros
### recheck all these
Requires:       python-Pygments
Requires:       python-docutils
Requires:       python-imaging
Requires:       python-pdfrw
Requires:       python-reportlab >= 2.6
Requires:       python-svg2rlg
###
Requires(post): update-alternatives
Requires(postun): update-alternatives
###
Recommends:     python-wordaxe
BuildArch:      noarch
%python_subpackages

%description
The usual way of creating PDF from reStructuredText is by going through LaTeX.
This tool provides an alternative by producing PDF directly using the ReportLab library.

%prep
%setup -q -n rst2pdf-%{version}
sed -i -e '1{/^#!/d}' \
	rst2pdf/findfonts.py \
	rst2pdf/dumpstyle.py

%build
%python_build

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

%check
PATH=$PATH:%{buildroot}/%{name}-%{version}%{_bindir} %pytest

%post
%python_install_alternative rst2pdf

%postun
%python_uninstall_alternative rst2pdf

%files %{python_files}
%license LICENSE.txt
%doc CHANGES.rst README.rst
### doc/*.pdf
%python_alternative %{_bindir}/rst2pdf
%{python_sitelib}/*

%changelog
openSUSE Build Service is sponsored by