#
# spec file for package python-svg2rlg
#
# Copyright (c) 2015 SUSE LINUX Products 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/
#


Name:           python-svg2rlg
Version:        0.3
Release:        5.1
Summary:        A library for importing SVG into reportlab
License:        BSD-3-Clause
Group:          Development/Languages/Python
Url:            http://code.google.com/p/svg2rlg/
Source:         http://pypi.python.org/packages/source/s/svg2rlg/svg2rlg-%{version}.tar.gz
# Patches taken from upstream VCS
Patch0:         svg2rlg-issue-3.patch
Patch1:         svg2rlg-issue-6.patch
Patch2:         svg2rlg-issue-7.patch
BuildRequires:  dos2unix
BuildRequires:  python-setuptools
Requires:       python-reportlab
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} > 1110
BuildArch:      noarch
%endif

%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}
# fix dos encodings
find -name '*.py' -exec dos2unix {} +
%patch0 -p1
%patch1 -p1
%patch2 -p1

%build
CFLAGS="%{optflags}" python setup.py build

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}

pushd %{buildroot}/%{_bindir}
for B in svg2rlg ; do
  mv  $B  $B-%{py_ver}
  ln -sf $B-%{py_ver} $B
done
popd


%files
%defattr(-,root,root,-)
%{python_sitelib}/*
%{_bindir}/svg2rlg-%{py_ver}
%{_bindir}/svg2rlg

%changelog
* Mon Jul 13 2015 toddrme2178@gmail.com
- Fix building on SLES 11
* Sat Nov  9 2013 tchvatal@suse.com
- Cleanup to build properly as it is needed by python-rst2pdf
- Add patches from upstream tracker:
  * svg2rlg-issue-3.patch
  * svg2rlg-issue-6.patch
  * svg2rlg-issue-7.patch
* Sat Apr  6 2013 jw@suse.com
- pulled from pypi, handcrafted specfile, as py2pack explodes.
- CAUTION: with my testdata:
  /usr/lib/python2.7/site-packages/svg2rlg.py explodes in line 626, in iterparse
  assertion(token is string, 'Expected string in path data')