File gHRV.spec of Package gHRV

#
# spec file for package gHRV
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2014 M. Baranauskas <embar@super.lt>
#
# 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:           gHRV
Version:        1.91
Release:        0
Summary:        A graphical tool for Heart-Rate Variability analysis
License:        GPL-3.0+
Group:          Productivity/Scientific/Math

Url:            http://milegroup.github.io/ghrv
Source0:        http://www.milegroup.net/files/ghrv/ghrv_%{version}.tar.gz
Source1:        gHRV-icon.png
BuildRequires:  python
Requires:       python
Requires:       python2-matplotlib-wx
Requires:       python2-numpy >= 1.5.1
Requires:       python2-scipy >= 0.9.0
Requires:       python-wxWidgets
#Requires:       python-gtk
#Requires:       python-matplotlib-gtk
%if 0%{?suse_version} 
BuildRequires:  update-desktop-files
%endif
%if %{?suse_version: %{suse_version} > 1110} %{!?suse_version:1}
BuildArchitectures: noarch
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
gHRV is a graphical tool to clinicians and researchers interested in Heart Rate Variability Analysis.

The objective of gHRV is to be powerful and easy to use and install.

Main features:
- Reads Polar, Suunto, ASCII (beats and RR series) and   WFDB (qrs) beats files.
- Episodes can be read from ASCII files, inserted, edited and deleted. gHRV includes both a graphical and a spreadsheet-like tools for editing episodes.
- Time-domain, frequency-domain and non-linear analyses are included. Some of the included measures are:
  * Time-domain: SDNN, SDANN, rMSSD, SDNN index, pNN50, HRV triangular index and TIN.
  * Frequency-domain: power in ULF, VLF, LF and HF bands, total power and LF/HF ratio.
  * Non-linear: approximate entropy, fractal dimension and SD1 and SD2 from Poincaré plots.
- It generates high-quality plots that can be exported in eps, tiff, svg, png, pdf and jpg formats.
- It shows reports that can be saved in html format.
- Temporal evolution of frequency-domain and non-linear parameters can be represented and significance tests of these paremeters in different areas can be performed.

%prep
%setup -q -T -c -n %name -a0 

%build 

%install
for i in `ls ghrv_1_91/`;
do
  install -Dm0644 ghrv_1_91/${i} %{buildroot}%{python_sitelib}/%{name}/${i}
done
install -Dm0644 %{S:1} %{buildroot}%{_datadir}/pixmaps/gHRV-icon.png

# REMOVE SHEBANGS FROM NON-EXECUTABLE FILES
for i in gHRV EditNIHR Utils;
do
  sed -i '1d' %{buildroot}%{python_sitelib}/%{name}/${i}.py
done

%if 0%{?suse_version}
%py_compile %{buildroot}%{python_sitelib}/%{name}/
%else
python -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %{buildroot}%{python_sitelib}/%{name}/
%endif

# bash to start program 
mkdir -p %{buildroot}%{_bindir}
echo "#!/bin/bash
python %{python_sitelib}/%{name}/gHRV.py
" > %{buildroot}%{_bindir}/%{name}
chmod +x %{buildroot}%{_bindir}/%{name}

# .desktop file:
mkdir -p %{buildroot}%{_datadir}/applications
echo "[Desktop Entry]
Name=gHRV
GenericName=Software for heart rate variability analysis
GenericName[lt]=Širdies ritmo variabilumo analizės programa
GenericName[fi]=Sykevariaatioanalyysiohjelma
Comment=Analyze heart rate variability data
Comment[lt]=Širdies ritmo variabilumo analizavimas
Exec=gHRV
Icon=gHRV-icon
Type=Application
Terminal=false
StartupNotify=true
Encoding=UTF-8
X-SuSE-translate=true
Categories=Education;Math;
" > %{buildroot}%{_datadir}/applications/%{name}.desktop

%if 0%{?suse_version} >= 1140
%post
%desktop_database_post
%endif

%if 0%{?suse_version} >= 1140
%postun
%desktop_database_postun
%endif

%files 
%defattr(-,root,root)
%{_bindir}/%{name}
%{python_sitelib}/%{name}/
%{_datadir}/pixmaps/gHRV-icon.png
%{_datadir}/applications/%{name}.desktop

%changelog