File nagstamon.spec of Package nagstamon

#
# spec file for package nagstamon
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2011 Lars Vogdt
#
# 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:           nagstamon
Version:        0.9.11
Release:        0
Summary:        Nagios status monitor for the desktop
License:        GPL-2.0
Group:          System/Monitoring
Url:            http://nagstamon.ifw-dresden.de/
Source:         Nagstamon-%{version}.tar.bz2
Source1:        %{name}.desktop
BuildRequires:  python-devel
# openSUSE dependencies
%if 0%{?suse_version}
BuildRequires:  python-gtk
BuildRequires:  update-desktop-files
Requires:       python-gtk
%if 0%{?suse_version} > 1100
Requires:       python-distribute
Requires:       python-egg
%else
Requires:       python-gnome-extras
%endif
Recommends:     gnome-terminal
Recommends:     rdesktop
Recommends:     sox
Recommends:     tightvnc
%if 0%{?suse_version} > 1130
BuildArch:      noarch
%endif
%py_requires
%endif
# Fedora dependencies
%if 0%{?fedora_version}
BuildRequires:  desktop-file-utils
BuildRequires:  pygtk2
Requires:       pygtk2
Requires:       python-setuptools
%endif
# Mandriva dependencies
%if 0%{?mandriva_version}
BuildRequires:  desktop-file-utils
Requires(post): desktop-file-utils
Requires(postun): desktop-file-utils
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}

%description
Nagstamon is a Nagios status monitor which takes place in systray or on desktop
(GNOME, KDE, Windows) as floating statusbar to inform you in realtime about the
status of your Nagios and derivatives monitored network. It allows to connect
to multiple Nagios, Icinga, Opsview, Op5, Check_MK/Multisite and Centreon
servers.

%prep
%setup -q -n Nagstamon-%{version}
# currently we use our own desktop file
test -f Nagstamon/resources/nagstamon.desktop && rm Nagstamon/resources/nagstamon.desktop

%build
python setup.py build

%install
python setup.py install \
 				--root=%{buildroot} \
				--install-lib=%{python_sitelib} \
				--prefix=%{_prefix}
chmod +x %{buildroot}/%{python_sitelib}/Nagstamon/Server/Multisite.py
mv %{buildroot}/%{_bindir}/nagstamon.py %{buildroot}/%{_bindir}/nagstamon
# desktop stuff
mkdir -p %{buildroot}%{_datadir}/{applications,pixmaps}
cp Nagstamon/resources/nagstamon.svg %{buildroot}%{_datadir}/pixmaps/nagstamon.svg
chmod -x %{buildroot}%{_datadir}/pixmaps/nagstamon.svg
install -Dm644 %{SOURCE1} %{buildroot}/%{_datadir}/applications/nagstamon.desktop
# openSUSE
%if 0%{?suse_version}
%suse_update_desktop_file -i %{buildroot}/%{_datadir}/applications/nagstamon.desktop
%endif
# Fedora
%if 0%{?fedora_version}
desktop-file-install --dir %{buildroot}/%{_datadir}/applications \
    --vendor OBS \
    --delete-original \
    %{buildroot}/%{_datadir}/applications/nagstamon.desktop
%endif
# Mandriva
%if 0%{?mandriva_version}
desktop-file-install --vendor="OBS" \
  --dir=%{buildroot}%{_datadir}/applications \
  %{buildroot}/%{_datadir}/applications/nagstamon.desktop

%post
%{update_menus}

%postun
%{clean_menus}
%endif

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc ChangeLog COPYRIGHT LICENSE
%{_datadir}/pixmaps/nagstamon*
%{_datadir}/applications/*nagstamon.desktop
%{python_sitelib}/Nagstamon/
%{_bindir}/nagstamon
%{_mandir}/man1/nagstamon.1*
%if 0%{?suse_version} > 01020 || 0%{?fedora_version} || 0%{?mandriva_version} || 0%{?rhel_version} > 505 || 0%{?centos_version} > 505
%{python_sitelib}/%{name}*.egg-info
%endif

%changelog
openSUSE Build Service is sponsored by