#
# spec file for package python-xhtml2pdf
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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/
#


%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name:           python-xhtml2pdf
Version:        0.2b
Release:        1.2
Summary:        PDF Generator Using HTML and CSS
License:        Apache-2.0
Group:          Development/Languages/Python
Url:            https://github.com/xhtml2pdf/xhtml2pdf
Source:         https://github.com/xhtml2pdf/xhtml2pdf/archive/%{version}.tar.gz
BuildRequires:  %{python_module Pillow >= 2.0}
BuildRequires:  %{python_module PyPDF2 >= 1.26}
BuildRequires:  %{python_module html5lib >= 1.0b10}
BuildRequires:  %{python_module httplib2 >= 0.7.6}
BuildRequires:  %{python_module nose >= 1.3.3}
BuildRequires:  %{python_module reportlab >= 3.0}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module six}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
Requires:       python-Pillow >= 2.0
Requires:       python-PyPDF2 >= 1.26
Requires:       python-html5lib >= 1.0b10
Requires:       python-httplib2 >= 0.7.6
Requires:       python-reportlab >= 3.0
Requires:       python-six
Conflicts:      python-pisa
BuildArch:      noarch

%python_subpackages

%description
xhtml2pdf is a html2pdf converter using the ReportLab Toolkit, the HTML5lib and
pyPdf. It supports HTML 5 and CSS 2.1 (and some of CSS 3). It is completely
written in pure Python so it is platform independent.

The main benefit of this tool that a user with Web skills like HTML and CSS is
able to generate PDF templates very quickly without learning new technologies.

%prep
%setup -q -n xhtml2pdf-%{version}
# sed out hardcoded html5lib require
sed -i \
    -e 's:==1.0b10::g' \
    setup.py
# remove turbogears module (broken)
rm -rf xhtml2pdf/turbogears.py

%build
%python_build

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

%check
%python_exec setup.py test

%files %python_files
%doc LICENSE.txt README.rst
%{python_sitelib}/*
%python3_only %{_bindir}/pisa
%python3_only %{_bindir}/xhtml2pdf

%changelog
* Fri Dec 15 2017 tchvatal@suse.com
- Switch to downloadable url
- Remove pointless patch
* Fri Dec 15 2017 tchvatal@suse.com
- Cleanup a bit
- Update the requirements to match the upstream recommendations
- Run the tests
- Really enable the python3
* Thu Dec 14 2017 opensuse@dstoecker.de
- update to 0.2b
- support build for python3
* Fri Aug 12 2016 opensuse@dstoecker.de
- update to 0.1b2
* Fri Nov 15 2013 p.drouand@gmail.com
- Update to version 0.0.5
  + no changelog available
- Remove useless CFLAGS definition
* Thu Oct 24 2013 speilicke@suse.com
- Require python-setuptools instead of distribute (upstreams merged)
* Wed Dec 12 2012 jfunk@funktronics.ca
- Initial release