File RunSnakeRun.spec of Package RunSnakeRun

#
# spec file for package RunSnakeRun
#
# Copyright (c) 2017 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:           RunSnakeRun
Version:        2.0.4
Release:        0
Url:            http://www.vrplumber.com/programming/runsnakerun/
Summary:        GUI Viewer for Python profiling runs
License:        BSD-3-Clause
Group:          Development/Languages/Python
Source:         https://files.pythonhosted.org/packages/source/R/RunSnakeRun/RunSnakeRun-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  fdupes
BuildRequires:  python-devel
BuildRequires:  python-SquareMap
BuildRequires:  python-numpy
BuildRequires:  python-wxWidgets
BuildRequires:  update-desktop-files
Requires:       python-SquareMap
Requires:       python-numpy
Requires:       python-wxWidgets
# FIXME Change from <= to < after next release
Obsoletes:      python-%{name} < %{version}
Obsoletes:      python-%{name}-doc < %{version}
Provides:       python-%{name} = %{version}
Provides:       python-%{name}-doc = %{version}
BuildArch:      noarch

%description
GUI Viewer for Python profiling runs. Provides explorability and overall
visualization of the call tree and package/module structures.

%package doc
Summary:        Documentation for %{name}
Requires:       %{name} = %{version}
Group:          Development/Languages/Python

%description doc
Documentation and help files for %{name}

%prep
%setup -q
chmod 0644 doc/greypinstripe.png
sed -i "s|#!/usr/bin/env python||" runsnakerun/*.py
sed -i "s|#! /usr/bin/env python||" runsnakerun/*.py

%build
python setup.py build

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
chmod 0755 %{buildroot}%{python_sitelib}/runsnakerun/{_meliaejson,meliaeadapter,meliaeloader,runsnake}.py

# create executable
mkdir -p %{buildroot}%{_bindir}
pushd %{buildroot}%{_bindir}
ln -s %{python_sitelib}/runsnakerun/runsnake.py runsnake
popd

# install icon
install -Dpm 0644 doc/pyaccellerate-64.png %{buildroot}%{_datadir}/pixmaps/%{name}.png

# add icon to desktop file
sed -i 's/Icon=/Icon=RunSnakeRun/' %{name}.desktop

%suse_update_desktop_file -i %{name} Profiling

# install the documentation
mkdir -p %{buildroot}%{_docdir}/%{name}
install -pm 0644 doc/* %{buildroot}%{_docdir}/%{name}/

%fdupes -s %{buildroot}

%files
%defattr(-,root,root,-)
%doc license.txt
%exclude %{_docdir}/%{name}/*.css
%exclude %{_docdir}/%{name}/*.html
%exclude %{_docdir}/%{name}/*.png
%{_bindir}/runsnake
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/applications/%{name}.desktop
%{python_sitelib}/runsnakerun/
%{python_sitelib}/%{name}-%{version}-py*.egg-info

%files doc
%defattr(-,root,root,-)
%{_docdir}/%{name}/
%exclude %{_docdir}/%{name}/license.txt

%changelog
openSUSE Build Service is sponsored by