File retext.spec of Package retext

#
# spec file for package retext
#
# Copyright (c) 2010 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/
#

%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%{!?py_ver: %global py_ver %(%{__python} -c "import sys; v=sys.version_info[:2]; print '%%d.%%d'%%v" 2>/dev/null || echo PYTHON-NOT-FOUND")}

Name:       retext
Version:	4.0.0
Release:	0
License:	GPL-3.0+
Summary:	Simple editor for Markdown and reStructuredText
Url:		http://sourceforge.net/p/retext/home/ReText
Group:		Productivity/Editors/Other
Source:		ReText-%{version}.tar.gz
Source1:	%{name}.desktop
BuildRequires:	update-desktop-files
BuildRequires:	rsvg-view
BuildRequires:  python-devel
Requires:	python-qt4
Requires:	python-markdown
Requires:	python-docutils	
Requires:   python-enchant
Requires:   python-Markups
Provides:	ReText = %{version}
BuildRoot:  %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} >= 1140
BuildArch:	noarch
%endif

%description
ReText is simple text editor that supports Markdown and reStructuredText
markup languages. It is written in Python using PyQt libraries.

%prep
%setup -q -n ReText-%{version}

%build
python setup.py build

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

%{__mkdir} -pv %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/
%{__mkdir} -pv %{buildroot}%{_datadir}/%{name}/
%{__mkdir} -pv %{buildroot}%{_datadir}/applications/

%{__cp} -r templates %{buildroot}%{_datadir}/%{name}/
%{__cp} -r icons/*.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/
ICONSIZE="16 22 32 48 64 128 256"
pushd %{buildroot}%{_datadir}/icons/hicolor/
for i in $ICONSIZE; do
  mkdir -pv ${i}x${i}/apps/
  rsvg-convert -h $i -w $i scalable/apps/%{name}.svg -o ${i}x${i}/apps/%{name}.png
done
popd
%{__cp} -r %{S:1} %{buildroot}%{_datadir}/applications/

ln -sf %{_bindir}/%{name}.py %{buildroot}%{_bindir}/%{name}

%suse_update_desktop_file %{name}


%files
%defattr(-,root,root)
%doc changelog.md README
%{_bindir}/%{name}
%{_bindir}/%{name}.py
%{_bindir}/wpgen.py
%{python_sitelib}/ReText/
%{python_sitelib}/ReText-%{version}-py%{py_ver}.egg-info
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{_datadir}/%{name}/
%{_datadir}/applications/%{name}.desktop

%changelog
openSUSE Build Service is sponsored by