File scour.spec of Package scour

#
# spec file for package scour (Version 0.25)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2010 Guido Berhoerster.
#
# 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:           scour
Version:        0.25
Release:        1
License:        ASL 2.0 and BSD
Summary:        Tool for Reducing the Size of SVG Files
Url:            http://www.codedread.com/scour/
Group:          Productivity/Graphics/Other
Source:         http://www.codedread.com/scour/scour-%{version}.zip
BuildRequires:  unzip
BuildRequires:  ed
BuildRequires:  fdupes
BuildRequires:  python-devel
Requires:       python-xml
%{py_requires}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
Scour is a tool for reducing the size of SVG files as much as possible, while
retaining the original rendering of the files.

Optimisations performed by Scour on SVG files include: removing empty elements,
removing metadata elements, removing unused id= attribute values, removing
unrenderable elements, trimming coordinates to a certain number of significant
places, and removing vector editor metadata.

%prep
%setup -q -n %{name}
sed -e 's/\(svg_regex\|svg_transform\|yocto_css\)\( \|$\)/scour.\1\2/g' scour.py >scour
for file in svg_transform.py yocto_css.py; do
  ed -s ${file} <<EOF
/#!\/usr\/bin\/env/d
w
EOF
done

%build
touch __init__.py

%install
for file in __init__.py svg_regex.py svg_transform.py yocto_css.py; do
  install -D -p -m 644 ${file} %{buildroot}%{python_sitelib}/scour/${file}
done
install -D -p -m 755 scour %{buildroot}%{_bindir}/scour
%py_compile %{buildroot}%{python_sitelib}/scour/
%py_compile -O %{buildroot}%{python_sitelib}/scour/
%fdupes %{buildroot}%{python_sitelib}/scour/

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%doc LICENSE README.txt release-notes.html
%{_bindir}/scour
%{python_sitelib}/scour/

%changelog